I'm going crazy why my css file isn´t getting loaded. I'm using spring mvc 4 + apache tomcat 8
I already use the same code for other projects and it works normally.
Here's my project structure
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>AO</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>hibernate.xml</param-value>
</context-param>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>mvc-dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
my servlet context :
<context:component-scan base-package="controller"/>
<mvc:annotation-driven />
<mvc:resources mapping="/RESOURCES/**" location="/RESOURCES/" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>
when he try to load :
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/RESOURCES/css/welcome.css" >
or
<link rel="stylesheet" type="text/css" href="/RESOURCES/css/welcome.css">
or
<link rel="stylesheet" type="text/css" href="/AO/RESOURCES/css/welcome.css">
i got this error:
GET http://localhost:8080/AO/RESOURCES/css/welcome.css 404 (Introuvable)
Try adding <mvc:default-servlet-handler /> to your mvc configuration file.
change the mapping for RESOURCES to LOWERCASE resources
Except the name of your Application,which can contain Uppercase elements, the path for resources must contain only lowercase
<mvc:resources mapping="/resources/**" location="/RESOURCES/" />
Then ref :
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/css/welcome.css" >
Use c:url tag of JSP Standard Tag Library to make the URL relative.
<%#taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel=stylesheet href="<c:url value='/RESOURCES/css/welcome.css'/>"
type="text/css" />
I Delete the Apache tomcat server and I add it again and finally my CSS has been loaded :)
Can somebody explain me why ?
Related
I have a Java web application with struts2 framework. in my index.jsp file, I link the CSS file, but it doesn't show in my page and Error 404: not found display in Firebug. I tested one application without Struts and everything is fine. but when i add struts2 library and config struts.xml and web.xml file, CSS doesn't display :(
here is my index.jsp:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="styles/main.css" rel="stylesheet" type="text/css"/>
</head>
Of course, I add <%# taglib prefix="s" uri="/struts-tags" %> and tried <s:url> in href, but don't see any effect.
here is web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<display-name>HotelSystem</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
and here is part of my struts.xml:
<package name="default" namespace="/" extends="struts-default">
<action name="index.jsp" class="Actions.Test">
<result name="success">/index.jsp</result>
</action>
</package>
Note: Action.Test is a test action and always return SUCCESS.
You should map the .css type in the web.xml file as following!
<filter-mapping>
<filter-name>expires-filter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
I am using spring MVC to run my dynamic web application. I am able to write one and run the app successfully. But problem is with loading the resource files like image,JS and CSS. I am getting file Failed to load resource. key point is i am placing the JSP files Outside WEB-INF and Using web logic server.
My web.xml file
<display-name>Support</display-name>
<welcome-file-list>
<welcome-file>resources/jsp/home.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc-servlet.xml,/WEB-INF/spring-jpa.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
my dispathcer servlet
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/resources/"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/resources/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
I have added this in my JSp file
<link media="screen" rel="stylesheet" href="<spring:url value='resources/css/Map.css' />" type="text/css" />
<spring:url value="resources/css/Mass.css" var="resourceUrl2"/>
<LINK media="screen" rel="stylesheet" TYPE="text/css" href="${resourceUrl2}" />
Getting the Failed to load resource: the server responded with a status of 404.
any Help???
Update:
What I found with my weblogic server is not able to get the context value for this app. so got the conext path in the jsp file and appended before resources. it worked for me
<link media="screen" rel="stylesheet" href="<%=request.getContextPath()%>/resources/css/MaRK.css" type="text/css" />
still don't know why spring resources did not work.
I ran into the same issue and this is how i resolved the issue:
In spring configuration file
Replace
<mvc:resources mapping="/resources/**" location="/resources/"/>
With
<mvc:default-servlet-handler/>
And provide the below path in the JSP to load static contents
<link rel="stylesheet" href="resources/css/Mass.css" type="text/css"/>
Hope this will help !
Try this
<mvc:resources mapping="/resources/**" location="resources/"/>
Works for me.
I had the following in my JSP, and ran into the same problem:
<link href="/css/styles.css" rel="stylesheet" type="text/css">
After I removed leading / from /css/styles.css it loaded.
<link href="css/styles.css" rel="stylesheet" type="text/css">
I can't explain why. The answers written above did not help me. In fact, I don't even have a resources folder at all, all of my static content is placed directly in the /webapp folder—and, specifically, in /css, /jsp, and /WEB-INF subdirectories.
I am new to spring MVC and maven also. I created a maven web project in eclipse. Add dependencies for spring and run the project, but i am not getting the desired result. Here is my project structure
When i run the project then i get the result Hello World which is my index.jsp
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
But when i change to url http://localhost:8080/Spring_Maven/jsp/hello i get HTTP Status 500 error. And when i change to url http://localhost:8080/Spring_Maven/jsp/hello.jsp then i get the output ${message}
Here is my hello.jsp page
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hello</title>
</head>
<body>
<h1>${message}</h1>
</body>
</html>
Here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring_Maven</display-name>
<servlet>
<servlet-name>springMaven-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMaven-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springMaven-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
here is my springMaven-dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="pk.training.basitMahmood.springMaven.controller" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
Here are the list of dependencies that i added through maven
What i am doing wrong?
Finally i made it work :). But i want to share so people with new to maven and eclipse could save their time.
First i installed the m2e eclipse WTP plugin and then create the maven project as i described in my question. The thing that you need to do is to add the compiler plugin and JDK version in your pom.xml else each time you do right click on project --> Maven --> Update project you get an error in the marker tab about JRE and java EE configuration problem. You also ned to change in project facets by doing right click on project --> properties --> Project facets --> Change java version. Here is the snippet of the pom.xml.
<build>
<finalName>SpringMavenHelloWorld</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Then in the web.xml i updated the servelt schema, and i found that i need to define my servet-dispatcer.xml file in both dispatcher-servlet and in the servlet context. Here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Spring_Maven</display-name>
<servlet>
<servlet-name>springMaven-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/springMaven-dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMaven-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/springMaven-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Here is the structure of my project. I changed it a bit. Made a spring folder in WEB-INF and move the dispatcher servlet in it.
Although there is no lib folder in WEB-INF but everything is working fine. The thing that took my time so much is to define both servletcontext param and servelet init-param. If i only define servlet init param like
<servlet>
<servlet-name>springMaven-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/springMaven-dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMaven-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/springMaven-dispatcher-servlet.xml</param-value>
</context-param>
-->
then i got the error that
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext
resource [/WEB-INF/applicationContext.xml]
and if i define only the context param like
<servlet>
<servlet-name>springMaven-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/springMaven-dispatcher-servlet.xml</param-value>
</init-param>
-->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMaven-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/springMaven-dispatcher-servlet.xml</param-value>
</context-param>
then i got the error that
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from ServletContext resource
[/WEB-INF/springMaven-dispatcher-servlet.xml]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/springMaven-dispatcher-servlet.xml]
But defining both solve the issue. Now when i do right click on my project --> run on server then i get the page Hello World with url http://localhost:8080/SpringMavenHelloWorld/ and when i change it to http://localhost:8080/SpringMavenHelloWorld/hello then i get my desired output that is
Hope this will help others too. Thank you :)
I am developing a web application using Spring and Tomcat 7.0. When I test the page in a browser it does not apply the CSS because it is unable to load the external stylesheet.
Here are my various files
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>MyProject</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>ResourceServlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
</web-app>
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
<bean id="userService" class="com.abdus.service.UserServiceImpl" />
<context:component-scan base-package="com.abdus.web" />
<bean
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
</beans>
and this is the head from jsp page
welcomePage.jsp
<meta charset="utf-8"/>
<title>Welcome</title>
<link rel="stylesheet" href="/resources/dream.css" type="text/css" />
You're saying the css url is not accessible (as opposed to it not being applied to your jsp) right? What's the response when you browse to /resources/dream.css?
I have had issues before with tomcat not serving static content with a /* servlet mapping. The way I solved it was to explicitly map each content type in web.xml, including .css files, like so:
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
(where the "default" servlet is predefined by tomcat in conf/web.xml as org.apache.catalina.servlets.DefaultServlet)
It was actually a path issue. This was my directory structure
MyProject/WEB-INF/resources/dream.css
and in jsp link i had given it as href="/resources/dream.css" and i even tried href="MyProject/resources/dream.css".
But the wasy i resolved it is I made directory structure as
MyProject/resources/dream.css and
href="MyProject/resources/dream.css"
You could use jstl tags:
<%#taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<link href="<c:url value="/resources/style.css"/>" rel="stylesheet" type="text/css" />
Or you could use full resources path:
<base href="http://localhost:8080/myapp/" />
<link href="resources/style.css" rel="stylesheet" type="text/css" />
i am having issues loading a simple index.jsp page using spring 3 and tomcat 7.0
the error i recieve from the tomcat logs is this:
2011-02-07 11:36:18,510 DEBUG [org.springframework.web.servlet.DispatcherServlet] -
DispatcherServlet with name 'raceLeague' processing GET request for [/Online Racing League/index.htm]>
2011-02-07 11:36:18,515 WARN [org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP request with URI [/Online Racing League/index.htm] in DispatcherServlet with name 'raceLeague'>
2011-02-07 11:36:18,515 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request>
Here is what my web.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<!-- Reads request input using UTF-8 encoding -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Register and setup my servlet xml files here -->
<!-- Handles all requests into the application -->
<servlet>
<servlet-name>raceLeague</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/appServlet/servlet-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>raceLeague</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
And here is my servlet-context.xml file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Scans the classpath of this application for #Components to deploy as beans -->
<context:component-scan base-package="org.springframework.samples.mvc.basic" />
<!-- Configures the #Controller programming model -->
<mvc:annotation-driven />
<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/" view-name="welcome"/>
<!-- Configures Handler Interceptors -->
<mvc:interceptors>
<!-- Changes the locale when a 'locale' request parameter is sent; e.g. /?locale=de -->
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<!-- Saves a locale change using a cookie -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />
<!-- Application Message Bundle -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/messages/messages" />
<property name="cacheSeconds" value="0" />
</bean>
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
Finally my index.jsp file
<%# include file="/WEB-INF/views/include.jsp" %>
<html>
<head><title>Online racing league</title></head>
<body>
<h1>Test</h1>
<table>
<tr>
<td>Upload a file</td>
<td>Display App list</td>
</tr>
</table>
</body>
</html>
i basically followed this example here so my projetc structure is similar to that http://blog.springsource.com/2009/12/21/mvc-simplifications-in-spring-3-0/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Interface21TeamBlog+%28SpringSource+Team+Blog%29
I am also using eclipse IDE
You also need a <mvc:default-servlet-handler/> to serve static resources when your servlet is bound to /.