title: JS and CSS file not found error in spring 3.0 web mvc
body: <p>I am new to Spring, I am using spring 3.0 web mvc i am including js and css files but it is not applying on the pages.Firebug showing the 404 error for js and css files.
  I tried many combination to include the js and css file but nothing worked.
  please suggest something for this.
  directory structure is:</p>
  
  <pre><code>SpringApp
  --WebContent
    --resources
      --style.css
      --script.js
    --WEB-INF
      --views
             index.jsp
             ---------
  </code></pre>
  
  <p>Here is my web.xml file---</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  
  
  &lt;display-name&gt;DojoSpring&lt;/display-name&gt;
  &lt;servlet-name&gt;SpringDojo&lt;/servlet-name&gt;
  &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
  &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;SpringDojo&lt;/servlet-name&gt;
     &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Here is my Spring configuration file-----</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mvc="http://www.springframework.org/schema/mvc" 
  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.0.xsd
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schema/context/spring-context-3.0.xsd 
  http://www.springframework.org/schema/mvc 
  http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
  &lt;import resource="dbconfig.xml"/&gt;
  
  &lt;mvc:annotation-driven /&gt;
  &lt;mvc:default-servlet-handler/&gt;
  &lt;context:component-scan base-package="com.abc.controllers" /&gt;
  
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
  &lt;property name="prefix" value="/WEB-INF/views/"/&gt;
  &lt;property name="suffix" value=".jsp"/&gt;
  &lt;/bean&gt;
  
  &lt;/beans&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And here is my index.jsp file--------</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Spring&lt;/title&gt;
     &lt;script type="text/javascript" src="/resources/script.js"&gt;
  &lt;/head&gt;
  &lt;body onload="testFun()"&gt;
      Welcome to spring world....
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>