我的調度員servlet.xml中爲什麼我的JSP視圖沒有被解析?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:annotation-driven/>
<context:component-scan base-package="com.example" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/views/" p:suffix=".jsp" p:viewClass="org.springframework.web.servlet.view.JstlView"/>
</beans>
這是我的控制器
package com.example.spring;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HelloController {
@RequestMapping("/form.htm")
public ModelAndView hello(Model model) {
return new ModelAndView("index");
}
}
我看到這在我的控制檯時,我已經在調試應用程序。
WARNING: No mapping found for HTTP request with URI [/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dispatcher'
控制器被擊中,並返回視圖,但它不能被解析。
你可以發佈你的調度servlet的映射conf從web.xml – 2011-03-09 06:05:21
看看這個問題:http://stackoverflow.com/questions/1266303/no-mapping-found-for-http-request-with-uri -web-inf-pages-apiform-jsp – Javi 2011-03-09 08:58:03
你可以發佈項目的結構和web.xml嗎? – chris 2011-03-09 10:32:38