> This is no doubt a common question, but if I have a JSP page, that does =
> a FORM POST to a servlet, and that servlet's job is to do some parameter =
> checking, invoke the correct operations on beans/EJBs, then redirect the =
> user to the correct JSP page to display the results.

Well why do you want to redirect the user to the correct JSP why not forward
to it.
Redirecting is an expensive method as the response has to be sent to the
client followed
by the request back to the server.

>If I use the requestDispatcher.forward() call, the beans are remembered,
but the base
> URL remains the servlet's URL, not the JSP page that is displayed.
It looks like either you are getting the requestDispatcher from
ServletRequest or
you are passing the JSP path in such a way that it is relative to the
current request.
In both cases the path would be relative to the current request.

I think if you get the requestDispatcher  object from ServletContext and
pass the path
relative to root context i.e / then you should be fine i.e your path would
be relative to
your root context not servlet.

For e.g.

Say your servlet URL is
http://www.myserver.com/servlet/myservlet

now from ur servlet you can forward using the following path
getRequestDispatcher("/jsp/myjsp.jsp").forward(req, res);

/ above makes the path relative to ur root context not servlet request.


-Shiraz

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to