servlet有两种URL重定向的方法
1:
RequestDispatcher.forward方法
public void forward(ServletRequest request,
ServletResponse response)
throws ServletException,
java.io.IOException
它可以操作传到下一个URL的request对象内容,可以确定
Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. This method allows one servlet to do preliminary processing of a request and another resource to generate the response2:HttpServletReponse.sendRedirect方法
public void sendRedirect(java.lang.String location)
throws java.io.IOException
你的需要看来需要第一种!
1:
RequestDispatcher.forward方法
public void forward(ServletRequest request,
ServletResponse response)
throws ServletException,
java.io.IOException
它可以操作传到下一个URL的request对象内容,可以确定
Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. This method allows one servlet to do preliminary processing of a request and another resource to generate the response2:HttpServletReponse.sendRedirect方法
public void sendRedirect(java.lang.String location)
throws java.io.IOException
你的需要看来需要第一种!
forward(ServletRequest request, ServletResponse response)
Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server.
http://java.sun.com/products/servlet/2.3/javadoc/
这2个一定要啊,
不就行了吗?