• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Forwarding from a Servlet to a JSP

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question you ask is this question in the Servlet FAQ: Relative Links.
 
reply
    Bookmark Topic Watch Topic
  • New Topic