+1 vote
1 view
in Java by (41.4k points)

While working with Spring MVC it responds with a 404 error and reported: "No mapping found for HTTP request with URI[....] in DispatherServlet"?

1 Answer

0 votes
by (94.3k points)

All your request will be served by your standard Spring MVC application which will serve all requests through a DispatcherServlet that you've registered with your Servlet container. The DispatcherServlet looks at its ApplicationContext and, if available, the ApplicationContext registered with a ContextLoaderListener for special beans it needs to set up its request serving logic. These beans are described in the documentation.

Below is the code that explains the concept of DispatherServlet:-

public InternalResourceViewResolver resolver() {

    InternalResourceViewResolver vr = new InternalResourceViewResolver();

    vr.setPrefix("/WEB-INF/jsps/");

    vr.setSuffix(".jsp");

    return vr;

}

added tomcat-embed-jasper:

<dependency>

       <groupId>org.apache.tomcat.embed</groupId>

        <artifactId>tomcat-embed-jasper</artifactId>

       <scope>provided</scope>

</dependency>

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...