我收到此錯誤。未找到具有URI的HTTP請求的映射:在Spring MVC應用程序中
我的web.xml有這個
<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>
我有這個在我的web應用程序-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"/>
我com.web.SchedulingController看起來像這樣
/*
* 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;
}
}
當我點擊這個控制器的網址http://localhost:8080/project1/app/Scheduling.htm Scheduling_main.jsp會顯示,但圖像顯示不正確。此外,js和css文件沒有被渲染。
我訪問相似圖片
<img src="jquerylib/images/save_32x32.png" title="Save Appointment">
如果我更改了servlet定義的URL映射到的* .htm,圖像顯示得到罰款。你能指出我錯過了什麼地方嗎?
下面是完整的錯誤消息
WARN [PageNotFound] No mapping found for HTTP request with URI [/mavenproject1/app/jquerylib/images/save_32x32.png] in DispatcherServlet with name 'springweb'
非常感謝。 拉維
這裏是完整的錯誤消息: WARN [PageNotFound]發現用於與URI [/mavenproject1/app/jquerylib/images/save_32x32.png]在DispatcherServlet的名爲 'springweb' – Ravi 2009-10-02 17:11:41