1

我将我的请求从登录 servlet 转发到位于教员文件夹(子文件夹)中的 FacultyHomePage.jsp....页面已显示,但 url 仍然是 /LoginServlet。为什么网址没有变化??

    HttpSession sc= request.getSession();
          if(usertype==0)
          {
              sc.setAttribute("type", usertype);
              sc.setAttribute("id",id );
         rd=request.getRequestDispatcher("/faculty/FacultyHomePage.jsp");
         rd.forward(request, response);
          }
4

1 回答 1

5

request不会在请求调度程序中创建新对象。检查RequestDispatcher.forward方法。

如果您想更改 URL,请使用response.sendRedirect(java.lang.String)

于 2013-03-20T08:08:02.647 回答