Web tier: servlets, JSP, Web frameworks: Relative path can't be used in forward()'s target content?

  1. Hi, I am new in servlet and jsp. I am actually facing a problem when using the RequestDispatcher.forward()method. I used this method in one servlet and forward it to another jsp page. Let say my servlet's URL is http://localhost/servlets/SampleServlet, and my jsp's URL is at http://localhost/web/target.jsp. You can see the different layer fot the both URLs. The target.jsp actually contains other hyperlinks with URLs relative to itself. But when I forward from the servlet to the jsp, the jsp's content is still the same, but the URL now is actually the first one, the servlet's URL. Thus all the relative URLs in my original jsp now is relative to the servlet's URL, which is not wanted. Any suggestion to solve this problem?

    Wei Boon
  2. I ran into the same problem... did you ever come up with a solution?