tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Rink <krist...@zimmer428.net>
Subject Re: Resource configuration problems on servlets (images, css, javascript)
Date Tue, 28 Nov 2006 20:58:12 GMT

Hi;

Pascal Guy schrieb:
> The problem comes when we integrate to post the request to my controller
> The controller works fine but the resources are not working (css, images
> and javascript)


I am not sure to understand your problem right, but:

>    <servlet-mapping>
>        <servlet-name>controller</servlet-name>
>        <url-pattern>/controller</url-pattern>
>    </servlet-mapping>
[...]
> Do i need to map the resource types to something so it bypasses my
> servlet (and not be treated as a request)


There _will_ be a request for each and every static component (i.e.
image, css, js file, whatever) to be loaded from the server - but
indeed, you shouldn't have your controller taking care of that.

How are you referring to images and js from within your code? You should
be sure to use absolute URLS (i.e. "/images/logo.png" instead of
"images/logo.png"), otherwise you might end up with your server
searching for the content in a place where it's not supposed to be found
 (i.e. "/<servlet-context>/controller/images/logo.png"). If you keep
that in mind, chances are you won't have to do much configuration work
in your web.xml but simply ensure that folders containing static things
are somewhere out of the way of your servlet mappings.

Hope this helps, good luck to you!
Cheers,
Kris

---------------------------------------------------------------------
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
View raw message