"Bailey, Jeff A" wrote:
>
> Assuming i have this in a file called test.jsp
>
> <jsp:forward page="somepage.jsp" />
>
> Is there an easy way to update the url so that it shows the true location of
> the file http://blah.net/somepage.jsp instead of http://blah.net/test.jsp ?
>
> URL rewriting was a possible option but I cant figure out how to make it
> work if i want to move to a different directory level. (ie <jsp:forward
> page="/root/somepage.jsp" /> where the current page is located at
> /root/somedir/someotherdir/test.jsp)
Forward is like a function call from one JSP page to another, all on the
server side. So the client isn't aware of it at all and can't change the
location field in the browser. If it's important for you to see the URL
of the page you invoke, you have to use redirect instead. With redirect
you tell the client to load a new URL, so it will update the location field.
But a redirect has the overhead of a server-client round-trip, and in most
case it doesn't matter what URL is shown in the browser. The only time I
use redirect is when I don't want a reload to cause some expensive or
possible disruptive server side processing to occur. For instance, if the
first page stores some data in a database and then forwards to a JSP page
to show a confirmation message, reloading will cause the info to be stored
again. In this case I redirect to the confirmation page instead.
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html