No mapping found for HTTP request with URI: in a Spring MVC app
Posted
by Ravi
on Stack Overflow
See other posts from Stack Overflow
or by Ravi
Published on 2009-10-02T17:09:28Z
Indexed on
2010/05/07
2:48 UTC
Read the original article
Hit count: 1394
spring-mvc
Hello All,
I'm getting this error.
my web.xml has this
<servlet>
<servlet-name>springweb</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/web-application-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springweb</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
I have this in my web-application-config.xml
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
</bean>
<bean name="/Scheduling.htm" class="com.web.SchedulingController"/>
my com.web.SchedulingController looks like this
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class SchedulingController implements Controller{
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView modelAndView = new ModelAndView("/jsp/Scheduling_main.jsp");
modelAndView.addObject("message","Hello World MVC!!");
return modelAndView;
}
}
When I hit this controller with the URL http://localhost:8080/project1/app/Scheduling.htm The Scheduling_main.jsp gets displayed but the images are not displayed properly. Also the js and css file are not getting rendered.
I'm accessing the images like this
<img src="jquerylib/images/save_32x32.png" title="Save Appointment">
If I change the URL mapping in the servlet definition to *.htm, the images get displayed fine. Can you point out where I'm missing out.
Here is complete error message
WARN [PageNotFound] No mapping found for HTTP request with URI [/mavenproject1/app/jquerylib/images/save_32x32.png] in DispatcherServlet with name 'springweb'
Thanks a lot. Ravi
© Stack Overflow or respective owner