Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Servlet .forward not looking right in the URL

Status
Not open for further replies.

JaeBrett

Programmer
May 5, 2003
196
0
0
CN
When I do a RequestDispatcher.forward, it goes to the right page, but in the URL, it shows /servlet/login which is the path to my servlet. So I then have to change the paths of my images and everything else to reflect this. Know what I mean?

I want to use .forward but get back to the root of my context ... what can I do?
 
Only two ways that I know of:

1. In your JSP page, add <base href=&quot;
2. Use sendRedirect instead of forward, but then you lost the current request scope to the target JSP after sendRedirect.
 
I think of a 3rd way:

3. change all your image paths or another other href in the JSP relatively two level up. i.e. <img src=&quot;../../images/yourimage.gif&quot;/>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top