> 2) JSP files, even though accessing image files in the same directory
must use the previous directory, e.g., <img src="../imagename.jpg"> even
though the images are contained in the same directory.
What does the URL in your browser look like when you are access the JSP
pages? The browser constructs the full path to the image from the URL
used to request the page (JSP or HTML -- the browser doesn't know the
difference).
> My assumption is that JSP files are "rooted" in the WEB-INF directory
and so must use the previous directory notation back up a directory to
access the images contained the WebContent folder where everything else is.
Nope. They are "rooted" right where they are although internal
forwarding can make the request URL different from the actual location
of the JSP. In the past, I've done stuff like <img
src="${pageContext.request.contextPath}/WebContent/image.jpg"> to get
around these issues with an absolute path to the image. My example
assumes a servlet spec 2.4 webapp and container.
--David
Mike Molina wrote:
This thread is related to relative URL within JSP's and how they refer
to the local directory structure in a web application.
My directory structure in Tomcat goes something like this:
webapps/inprogress/WebContent
(Accessed through Tomcat as such:
http://127.0.0.1:8080/inprogres/WebContent
where WebContent contains my JSP and HTML files, WEB-INF, etc.
When creating img links to image files in the WebContent folder, I
noticed
1) HTML files can use the correct local pathname, e.g., <img
src="imagname.jpg">
however,
2) JSP files, even though accessing image files in the same directory
must use the previous directory, e.g., <img src="../imagename.jpg">
even though the images are contained in the same directory.
My assumption is that JSP files are "rooted" in the WEB-INF directory
and so must use the previous directory notation back up a directory to
access the images contained the WebContent folder where everything
else is.
Thus, I have two questions:
1) Why does this occur, and how can I modify my xml configuration
files so that JSP's reference links exactly as an html file in the
same directory would?
2) How can I change the root folder of tomcat to the
webapps/inprogress/WebContent directory, which xml files, and how
exactly should I modify them?
Thanks,
Mike M.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]