<fmt:requestEncoding value="charsetName">其中,value 用来指定字符编码。
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8a"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <!DOCTYPE html> <html> <head> <title>编程帮(www.lmcjl.com)</title> </head> <body> <body> <form action="index.jsp" method="post"> 关键字:<input name="key" /> <br /> <br /> <input type="submit"> </form> </body> </html>index.jsp 代码如下:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <!DOCTYPE html> <html> <head> <title>编程帮(www.lmcjl.com)</title> </head> <body> <body> <fmt:requestEncoding value="UTF-8" /> <c:out value="${param.key}"></c:out> </body> </html>
本文链接:http://task.lmcjl.com/news/15949.html