后台传值中文,前台乱码,怎么解决
1个回答
展开全部
首先:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
并且
request.setCharacterEncoding("gb2312");
第二:
配置 server.xml。
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>
第三:
配置 web.xml
<filter>
<filter-name>setEncoding</filter-name>
<filter-class>com.dinner.filter.CharsetFilters</filter-class>
<init-param>
<param-name>coding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
并且
request.setCharacterEncoding("gb2312");
第二:
配置 server.xml。
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>
第三:
配置 web.xml
<filter>
<filter-name>setEncoding</filter-name>
<filter-class>com.dinner.filter.CharsetFilters</filter-class>
<init-param>
<param-name>coding</param-name>
<param-value>UTF-8</param-value>
</init-param>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询