On Tue, 17 Apr 2001, Sundaram Ramasamy wrote:

> Hi,
> 
> I am using tomcat 3.2. I am calling servlet like this.
> 
> http://localhost/employee/servlet/dispPage?p=sales
> 
> from servlet I redirecting to jsp page. But jsp page URL coming like this
> 
> http://localhost/employee/servlet/disp.jsp
> 

Are you talking about the location that shows in your browser?  If so,
that is just the way that RequestDispatcher.forward() works -- it all
happens on the server side, and the browser has no clue what happens.  All
it knows is the location to which it submitted the form.

If you really want to change the value shown in the browser location bar,
you need to use response.sendRedirect() instead.  However, if you do this,
two bad things happen:
* You suffer from worse performance, due to the extra round
  trip from the client
* You can no longer use request attributes to pass information to the
  JSP page.

The best strategy is to simply teach your users to totally ignore the
value shown in the location window -- it is totally irrelevant on a web
application (as opposed to a web site).

Craig McClanahan

Reply via email to