My web.xml is:
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” id=”WebApp_ID” version=”2.5″>
TestStruts2
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>
org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG
</param-name>
<param-value>
/WEB-INF/tiles-defs.xml
</param-value>
</context-param>
<listener>
<listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>/WEB-INF/Templates/Jsp/index.jsp</welcome-file>
</welcome-file-list>
I’m using Spring and Tiles2.1
My resource folder is in /WEB-INF/Templates/Resources/
DispatcherServlet is set to map all (“/”). I want to exclude “Resources” folder (that contains images,css) because tomcat doesn’t show images and css. It sayes something like: ,,No mapping found for ….”
Take the resources like images, css etc. out of WEB-INF.
“WEB-INF” is not for static resources and it’s used to contain program code (JSPs, class files, libraries, etc.) and prevent access from outside. It is not a good practice to put your resources into your project archive (.war, .ear) because your package will be very heavy weight to deploy.
means that your dispatcherServlet maps the requests http://host/applicationName/*
You can put your resources into vhost/host.com/httpdocs/images of your host independent from your java application. say:
http://host/myimages/
and relatively accessable from your templeates (jsps)
therefore your packages would be smaller and speedy to deploy 😉