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

jsp,servlet问题
我的登录界面的form类容为:
HTML code

<form action="http://localhost:8080/servlet/Webbeans.Director" method="post">
<input type="hidden" name="action" value="Login">
<p>
User name:
<input type="text" name="userName">
</p>
<p>Password:
<input type="PASSWORD" name="password">
</p>
<p>
<input type="submit" value="Login">
<input type="Reset" value="reset">
</p>
</form>


当输入用户名和密码时就转到Director执行
我的Director里的一段代码为:
[code=Java]
if("Login".equalsIgnoreCase(action))
  {
  UserAuth userAuth;
  userAuth=(Webbeans.UserAuth)request.getSession().getAttribute("userAuth");
  userAuth.setUserName(request.getParameter("userName"));
  userAuth.setPassword(request.getParameter("password"));
  if(!userAuth.isValidUser())
  {
  myForward("http://localhost:8080/Login.jsp",request,response);
  return;
  }
  else action="SearchesWithJavaScript";
  }
  }
  catch(SQLException ee)
  {
  ee.printStackTrace();
  }
 
  if("SearchesWithJavaScript".equalsIgnoreCase(action))
  {
  myForward ("http://localhost:8080/SearchesWithJavaScript.jsp",request,response);
  return;
  }
[/code输入错误的密码后,按理应该转到]http://localhost:8080/Login.jsp重新输入
可就是老是提示错误的URL,

type Status report

message /servlet/http:/localhost:8080/Login.jsp

description The requested resource (/servlet/http:/localhost:8080/Login.jsp) is not available.
/servlet/http:/localhost:8080/Login.jsp地址前面总有个/servlet/很烦人。怎么会出现这个啊?郁闷!
忘高手指教!急等!

我的JSP的目录在E:\Tomcat\Tomcat 6.0\webapps\ROOT
Director目录在E:\Tomcat\Tomcat 6.0\webapps\ROOT
急求啊!!!!!郁闷!!!!


------解决方案--------------------
myForward("http://localhost:8080/Login.jsp",request,response); 

改成

myForward("/Login.jsp",request,response); 

看看