title: Spring MVC, CSS, and JavaScript is not working properly
body: <p>The CSS and JavaScript is not take effect on my page.
  I googled online, people saying this is the magic, but not happening on my page.</p>
  <pre><code>&lt;mvc:resources mapping=&quot;/resources/**&quot; location=&quot;/resources/&quot; /&gt;
  </code></pre>
  <p>This is the error:</p>
  <pre><code>Nov 02, 2013 9:19:29 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/myweb/resources/css/styles.css] in DispatcherServlet with name 'dispatcher'
  Nov 02, 2013 9:19:29 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/myweb/resources/script.js] in DispatcherServlet with name 'dispatcher'
  Nov 02, 2013 9:19:29 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/myweb/resources/js/jquery-1.10.2.min.js] in DispatcherServlet with name 'dispatcher'
  </code></pre>
  <p>Here is the applicationContext.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
  xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:p=&quot;http://www.springframework.org/schema/p&quot; xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot;
  xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
  xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans 
  http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  http://www.springframework.org/schema/mvc
  http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schema/context/spring-context-3.2.xsd
  http://www.springframework.org/schema/tx
  http://www.springframework.org/schema/tx/spring-tx-3.2.xsd&quot;&gt;
  
  &lt;context:component-scan base-package=&quot;org.peterhuang.myweb&quot; /&gt;
  
  &lt;mvc:resources mapping=&quot;/resources/**&quot; location=&quot;/resources/&quot; /&gt;
  
  &lt;bean
      class=&quot;org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter&quot;&gt;
  &lt;/bean&gt;
  
  &lt;bean
      class=&quot;org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping&quot;&gt;
  &lt;/bean&gt;
  
  &lt;!-- Hibernate Transaction Manager --&gt;
  &lt;bean id=&quot;transactionManager&quot;
      class=&quot;org.springframework.orm.hibernate4.HibernateTransactionManager&quot;&gt;
      &lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot; /&gt;
  &lt;/bean&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;!-- Activates annotation based transaction management --&gt;
  &lt;tx:annotation-driven /&gt;
  
  &lt;bean id=&quot;propertyConfigurer&quot;
      class=&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot;&gt;
      &lt;property name=&quot;location&quot; value=&quot;classpath:jdbc.properties&quot; /&gt;
  &lt;/bean&gt;
  
  &lt;bean id=&quot;viewResolver&quot;
      class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&gt;
      &lt;property name=&quot;viewClass&quot;
          value=&quot;org.springframework.web.servlet.view.JstlView&quot; /&gt;
      &lt;property name=&quot;prefix&quot; value=&quot;/WEB-INF/&quot;&gt;&lt;/property&gt;
      &lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot;&gt;&lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id=&quot;dataSource&quot;
      class=&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot;&gt;
      &lt;property name=&quot;driverClassName&quot; value=&quot;${jdbc.driverClassName}&quot; /&gt;
      &lt;property name=&quot;url&quot; value=&quot;${jdbc.url}&quot; /&gt;
      &lt;property name=&quot;username&quot; value=&quot;${jdbc.username}&quot; /&gt;
      &lt;property name=&quot;password&quot; value=&quot;${jdbc.password}&quot; /&gt;
  &lt;/bean&gt;
  
  &lt;bean id=&quot;sessionFactory&quot;
      class=&quot;org.springframework.orm.hibernate4.LocalSessionFactoryBean&quot;&gt;
  
      &lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; /&gt;
      &lt;property name=&quot;packagesToScan&quot; value=&quot;org.peterhuang.myweb&quot; /&gt;
      &lt;property name=&quot;hibernateProperties&quot;&gt;
          &lt;props&gt;
              &lt;prop key=&quot;hibernate.dialect&quot;&gt;
                  ${jdbc.dialect}
              &lt;/prop&gt;
              &lt;prop key=&quot;hibernate.show_sql&quot;&gt;
                  ${hibernate.show_sql}
              &lt;/prop&gt;
              &lt;prop key=&quot;hibernate.format_sql&quot;&gt;
                  ${hibernate.format_sql}
              &lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Here is the web.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;web-app id=&quot;WebApp_ID&quot; version=&quot;2.4&quot;
  xmlns=&quot;http://java.sun.com/xml/ns/j2ee&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&quot;&gt;
  
  &lt;display-name&gt;my web&lt;/display-name&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;/WEB-INF/jsp/welcome.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  </code></pre>
  
  <p>This is the page got displaied:</p>
  <pre><code>&lt;%@taglib uri=&quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot;%&gt;
  &lt;%@ taglib uri=&quot;http://www.springframework.org/tags&quot; prefix=&quot;spring&quot;%&gt;
  &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot;
  href=&quot;&lt;spring:url value='resources/css/styles.css' /&gt;&quot; /&gt;
  &lt;script type=&quot;text/javascript&quot;
  src=&quot;&lt;spring:url value='resources/js/jquery-1.10.2.min.js' /&gt;&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;spring:url value='resources/script.js'/&gt;&quot;&lt;/script&gt;     
  
  &lt;ul id=&quot;button&quot;&gt;
  &lt;c:forEach var=&quot;category&quot; items=&quot;${categoryList}&quot;&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;${category.categoryName}&lt;/a&gt;&lt;/li&gt;
  &lt;/c:forEach&gt;
  &lt;/ul&gt;
  </code></pre>
  <p>The folder structure in Eclipse:</p>
  <pre><code>myweb
    |
    |
    |
    |----Java Resources
    |             |
    |             |
    |             |-----src/main/resources
    |             |                |
    |             |                |
    |             |                |------js
    |             |                |       |
    |             |                |       |-----jquery-1.10.2.min.js
    |             |                |       |
    |             |                |       |
    |             |                |       |-----script.js
    |             |                |         
    |             |                |      
    |             |                |-----css
    |             |                |      |
    |             |                |      |-----style.css
    |             |                |      |
    |             |                |      |
  </code></pre>
  <p>Any tips would be appreciated!</p>