日期:2014-05-18  浏览次数:20603 次

关于JSP通过URL传参数的问题,DX帮忙,THX
a.jsp(html代码略,只写关键的)
<%@   page   contentType= "text/html;   charset=GB2312 "%>
<%
request.setCharacterEncoding( "gb2312 ");//这句有没有效果一样,试过了,我传的是英文字母和数字。
String   errorInfo=request.getParameter( "errid ");
if(errorInfo== "1001 ")
{errorInfo= "用户名或密码错误,请重新输入! ";}
else
    {errorInfo= " ";}
%>
b.jsp:
<%@   page   contentType= "text/html;   charset=GB2312 "%>
<%
String   errid;
errid= "1001 ";
response.sendRedirect( "a.jsp?errid= "+errid);
response.sendRedirect( "a.jsp?errid= ' "+errid+ " ' ");//这句替换上面出现同样情况
%>
a.jsp是登录页面,具体验证在b.jsp中(已略去,确定没问题),然后我返回。问题是:在a.jsp中,这样的比较竟然不是真,最后   errorInfo= " ",请问这是为什么?怎么解决?谢谢谢谢!!!


------解决方案--------------------
a.jsp(html代码略,只写关键的)
<%@ page contentType= "text/html; charset=GB2312 "%>
<%
request.setCharacterEncoding( "gb2312 ");//这句有没有效果一样,试过了,我传的是英文字母和数字。
String errorInfo=request.getParameter( "errid ");
if(errorInfo.compareTo( "1001 ")==0)//这儿修改一下 看行了不
{errorInfo= "用户名或密码错误,请重新输入! ";}
else
{errorInfo= " ";}
%>