0

I am building an web app using Spring MVC3 and Tiles3.. but I am getting some problem for loading static resource.

In web.xml I have the following code:

<filter>
    <filter-name>static-filter</filter-name>
    <filter-class>com.app.common.filter.DefaultFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>static-filter</filter-name>
    <url-pattern>/js/*</url-pattern>
    <url-pattern>/jsp/*</url-pattern>
    <url-pattern>/css/*</url-pattern>
    <url-pattern>/images/*</url-pattern>
</filter-mapping>

<servlet>
    <servlet-name>enlightened</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>enlightened</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

 <welcome-file-list>
    <welcome-file>/index.html</welcome-file>
 </welcome-file-list>

The DefaultFilter.java is like:

public class DefaultFilter implements Filter {

    private RequestDispatcher defaultRequestDispatcher;
    public void destroy() {}
    public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {
        defaultRequestDispatcher.forward(request, response);
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        this.defaultRequestDispatcher = filterConfig.getServletContext()
                .getNamedDispatcher("default");
    }

}

And My Folder structure is like:

WebContent --
          --- css/ all css files
          --- js / all js files
          --- images / all images
          --- jsp /
          -- WEB-INF
index.html

first I am getting the index.html correctly: by the link

http://myserver.com:8080/enlightened/index.html

in index.html i have:

 <table>  
      <tr>  
           <td><a href="home.html">Sign up!</a></td>  
      </tr> 
</table>

in my controller I have a method for the RequestMapping = /home

@RequestMapping("/home")  
     public String welcome() {  
         System.out.println("/home.htm");
         return "welcome";  
     } 

but I am not getting the flow in my controller when the

is clicked

Please help..

Arpan Das
  • 1,015
  • 3
  • 24
  • 57
  • what is the error you are getting?, your link is not working. – pappu_kutty Nov 21 '13 at 06:11
  • Thats a dummy link :) . first time the index.html is working fine, but when i am clicking on Sign up! on this link in index.html its showing HTTP Status 404 - /enlightened/home.htm -- The requested resource is not available. – Arpan Das Nov 21 '13 at 06:31
  • show your server log, the exception you get, it wont help with your 404 error. also show your tiles.xml file – pappu_kutty Nov 21 '13 at 06:50
  • request is not reaching to the controller. then only I can do something with the tiles.xml file. – Arpan Das Nov 21 '13 at 07:10

0 Answers0