邪了门了,点击登陆后竟然跳转到sousou页面,郁闷 请高手指点

xiaoshuidi123 2012-07-31 05:53:49
我有一个登录的页面,代码为
<body >
<center>
<form name="login" action="/CheckLoginServlet" method="post">
<table width="80%" border="1">
<tr>
<td align="center" colspan="2"><img src="images/regsucc.PNG" width="216" height="44" /></td>
</tr>
<tr>
<td width="50%"><div align="right">用户名:</div></td>
<td width="50%"><input type="text" name="username" /></td>
</tr>
<tr>
<td><div align="right">密码:</div></td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td align="right"><input type="submit" name="login" value="登录"/> </td>
<td ><div align="left"><a href="register.jsp"><img src="images/rereg.PNG" width="90" height="32" border="0"/></a></div></td>
</tr>
</table></form>
</center> </body>
</html>

CheckLoginServlet的代码为:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

/**response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the GET method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();*/
String username=request.getParameter("username");
String password=request.getParameter("password");
HttpSession session=request.getSession();
session.setAttribute("user", username);
CheckUser user=new CheckUser();
boolean i=user.check(username, password);
if (i==true){
request.getRequestDispatcher("index.jsp").forward(request, response);
}else{
response.sendRedirect("loginError.jsp");
}


}


public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

this.doPost(request, response);
}

}
我点击登陆之后,却出现

...全文
101 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoshuidi123 2012-08-02
  • 打赏
  • 举报
回复
我用的是ie浏览器呀?!晕 该怎么办呢
  • 打赏
  • 举报
回复
这个是搜索引擎 太强大,把他当成你搜索的字符串了。我就纳闷了,用ie我就算写完整的url,都被sousou搜索了,所以搜搜搜索引擎的插件最好不装。。

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧