url and src path problems
Hi,
I have a web-app with the following structure.
- WebModule/mydirectory/jsp's
- src/mydirectory/servlets
The web.xml looks like this:
<servlet>
<servlet-name>servlet1</servlet-name>
<servlet-class>mydirectory.Servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servlet1</servlet-name>
<url-pattern>/servlet1</url-pattern>
</servlet-mapping>
I have a form in a jsp which submits to one of my servlets. Because the jsp is inside a directory i must go one directory level back to access the servlet in the parent directory (form action="../servlet1?params=...").
This servlet will forward to another jsp, and since it uses a forward and not a sendRedirect, the last path in the url is the servlets path. This creates a problem with src paths in the next jsp since the path in the url is not relative to where the jsp is.
Now, there are a few solutions to this problem such as:
putting images, javascripts, css files in both the WebModule directory and mydirectory; putting absolute paths for all src's; etc.
But is there a way to make the url contain the full path to the servlet. Since the directory name that contains the servlets and the jsp's is the same, this would resolve my problem of src paths. To better illustrate what the url looks like:
start url: www.site.com/mydirectory/jsp1.jsp
--submit form to servlet1, which then forwards to jsp2.jsp
current url: www.site.com/servlet1?params=...
--jsp2.jsp cannot find src files since all are in WebModule/mydirectory/
is it possible to make the url look like this after submitting to the servlet:
www.site.com/mydirectory/servlet1?params=...
Hope this is understandable.
Thanks for any help.

