请教一个jsp过滤器的问题
我是jsp初学者,我在学习过滤器的时候碰到一些问题,望各位大哥给予帮助。
我做了2个很简单的jsp文件,想通过text文本框提交信息到另外一个页面显示,输入英文字母没有问题,但是输入中文后就出现许多问号,而且不管我在web.xml的init-param里设置参数值为UTF-8还是
gb2312都无法解决,请各位大哥帮忙找找问题究竟出在哪里??
user.jsp的代码:
<%@page contentType= "text/html;charset=gb2312 "%>
<html>
<head> <title> 用户登录 </title> <head>
<body>
<form action= "login.jsp " enctype= "gb2312 ">
<p align= "center ">
姓名 <input type= "text " name= "name " size= "20 ">
<input type= "submit " value= "提交 ">
<input type= "reset " value= "重置 "> </p>
</form>
</body>
</html>
login.jsp的代码:
<%@page contentType= "text/html;charset=gb2312 "%>
<%@page import= "java.util.* "%>
<html>
<body>
你好, <%!String Name;%>
<%
Name=request.getParameter( "name ");
%>
<%=Name%>
今天是
<%
Date today=new Date();
%>
<%=today.getDate()%> 号,星期 <%=today.getDay()%>
<p align= "center ">
<form action= "user1.jsp ">
<input type= "submit " value= "返回 ">
</form> </p>
</body>
</html>
过滤器代码:
package filter;
import
java.io.IOException;
import javax.servlet.*;
public class RequestEncodingFilter implements Filter {
protected String encoding = null;
protected FilterConfig filterConfig = null;
protected boolean ignore = true;
protected ServletContext context;
public void init(FilterConfig filterConfig) throws
ServletException {
this.filterConfig = filterConfig;
context=filterConfig.getServletContext();
this.encoding = filterConfig.getInitParameter( "encoding ");
String value = filterConfig.getInitParameter( "ignore ");