楼主的register.jsp<%@ page contentType="text/html; charset=GBK" language="java" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<form method="post" action="showNick.jsp">
邮件: <input type="text"name="email" value="[email protected]" /> <br />
密码: <input type="password" name="password1" /> <br />
再次输入密码: <input type="password" name="password2" /> <br />
昵称 <input type="text" name="nickname" /> <br />
验证码: <image src="registercode" /> <input type="text" name="registerCode"> <br />
<input type="submit" value="注册"> </form>
</body>
</html> 
楼主的showNick.jsp<%@ page contentType="text/html; charset=GBK" language="java" %>
<html>
<head>
<title>t</title>
</head>
<body>
<% request.setCharacterEncoding("GBK"); %>
<%= request.getParameter("nickname")%>
</body>
</html> 试试吧。表单就用post,另外同一用上<%@ page contentType="text/html; charset=GBK" language="java" %>
楼主一会儿用<%@ page pageEncoding="utf-8"%>
一会儿又用<%request.setCharacterEncoding("utf-8");%> 
把自己都整晕了,呵呵。用老白的话说:整那些花花玩儿干嘛?

解决方案 »

  1.   

    呵呵!如楼上所说,
    1 表单提交你最好用POST
    2 UTF-8 编码,一个汉字是3个字节。 这点你可以到google搜索汉字就知道了
    3 每个文件的最前面,改成如下的样子
    <%@page contentType="text/html;charset=UTF-8" pageEncoding="utf-8"%>
    <%
    request.setCharacterEncoding("utf-8");
    %> 4 如果页面手工录入的中文出现乱码,则需要修改文件自身的编码类型
      

  2.   

    提交表单最好用post啊,还有在用URL重写时也会出现乱码现象,比如你传一个中文参数,在获取这个参数的时候就会抛出一个空指针异常。
      

  3.   

    按照1、3楼的提示我把页面头设置成这样
    <%@page contentType="text/html;charset=UTF-8" pageEncoding="utf-8" language="java" %> 
    <% 
    request.setCharacterEncoding("utf-8");  
    %>   然后改用post方法...这样就成功没问题但是.....
    我又回复成原来的样子,重启Tomcat,重开IE访问页面,居然也成功了(无限头晕中)
      

  4.   

    利用URL重写传递中字汉字的时候就容易出现乱码问题.所以用POST既安全性好,也可能解决这个问题.
      

  5.   

    tomcat 服务器 没有重新启动
      

  6.   

    也遇到这问题了,URL里有中文,导致下个页面无法正常显示……