String name = request.getParameter("sel");
System.out.println(name);
这是Action 里面写的,在servlet里面已经写上了
response.setContentType("text/html;charset=gb2312");
request.setCharacterEncoding("gb2312");
为什么name输入出来还是"??" ...
String name = request.getParameter("sel");
System.out.println(name);
这是Action 里面写的,在servlet里面已经写上了
response.setContentType("text/html;charset=gb2312");
request.setCharacterEncoding("gb2312");
为什么name输入出来还是"??" ...
在web.xml文件中配置试试
<filter>
<filter-name>Spring character encoding filter</filter-name>
<filter-class>dorg.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Spring character encoding filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
加上response.setCharacterEncoding("gb2312");
并且都要在
String name = request.getParameter("sel");
这句前面