tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alec Swan <aukcio...@yahoo.com>
Subject Re: Serving CSS files from a certain URL
Date Tue, 04 Jul 2006 17:03:15 GMT
The problem is that my JSP uses relative paths to reference CSS files. These paths work fine
in the static mode, i.e. when I open JSP file directly in the browser without deploying it
on Tomcat. However, when I deploy the JSP all relative links stop working.

Here is an example. Suppose I have the following directory structure:
WEB-INF/jsp/Test.jsp
css/Styles.css

I need to reference Styles.css from Test.jsp in such a way that it works in static as well
as in deployed mode. Note that for this to work in the static mode (no web servers or servlet
containers) all paths should be relative. Therefore, when I deploy Test.jsp I want Tomcat
either to handle relative paths correctly or ignore the path altogether and just serve all
CSS file from a certain location (directory or URL).

The goal of all this is to maintain only one source tree used by web designers and Tomcat
administrator and avoid changing paths in JSP files during deployment.

I would appreciate any feedback on this.

Thanks.






Hassan Schroeder <hassan.schroeder@gmail.com> wrote: On 7/2/06, Alec Swan  wrote:

> I have a servlet, which I deploy as a WAR file. I want this servlet to service all .jsp
requests, but have Tomcat service .css files from /site/css/ directory inside the servlet
WAR file. I don't want Tomcat to invoke my servlet when serving CSS files.

So what's the problem? You map your servlet to *.jsp, and everything
else goes to the DefaultServlet. Right?

How is this not working?
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message