Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forwarding from a Servlet to a JSP

 
Robert Stone
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everyone,

I am using the following code to forward from a Servlet to a JSP



and it works fine however when I get to the JSP the url is still in the context of the servlet

http://www.mywebsite.org/servlet/MyServlet

So, as a result the page is all a mess because it can't find the style sheet in the location "css/main.css" or any of the images in the "images/*.png" location because it needs to look in the location "/images/*.png" but the problem is that the first time the user hits this page it is not in the context of the servlet so everything needs to be in the former locations. If/When we return to the page because the user forgot some form data that is when there is a problem.

How can I fix this issue? Any help again will be greatly appreciated!

Thanks, in advance!

Robert



 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question you ask is this question in the Servlet FAQ: Relative Links.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic