request.getRequestDispatcher 问题
DataAccess da = new DataAccess();
String userName = request.getParameter( "userName ");
String userPwd = request.getParameter( "userPwd ");
ResultSet rs = da.getResult( "select * from UserInfo "
+ "where userName= ' "+userName+ " ' "
+ " and userPwd= ' "+userPwd+ " ' ");
out.write(userName+ " "+userPwd);
out.write( " <font size=7> "+da.getRowCount(rs)+ " </font> \n ");
try {
if(da.getRowCount(rs)> 0)
{
out.write( "rs ");
request.setAttribute( "userName ", userName);
request.getRequestDispatcher( "/welcome.jsp ").forward(request, response); //此句
}
else
{
out.write( "用户名或密码错误! ");
out.write( " <a href= 'Login.jsp '> 重登陆 </a> ");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
当加上那句转向的时候 如果我从前一个页面传来的值也只能输出一个用户名
后面就是四个? 然后什么也没了 更不能跳转 连其他的几个值也输出不了
请高手解决 谢谢
------解决方案-------------------- "四个? "中文字符集问题。
------解决方案--------------------你输出来不是又跳到/welcome.jsp了吗?怎么会看得到啊