根据Spring框架APIUrlFilenameViewController会不会返回视图(春MVC)
UrlFilenameViewController会的宗旨是:
回报变换的URL的虚拟路径到视图名称和查看
如果我对/info.xhtml要求,其逻辑视图名称是信息
见UrlFilenameViewController documentatio Ñ
两个web.xml和控制器根据
/WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8">
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>smac</display-name>
<servlet>
<servlet-name>controller</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
/WEB-INF/controller-servlet.xml
<?xml version="1.0" encoding="UTF-8">
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean class="org.springframework.web.servlet.view.InternalViewResolver">
<property name="prefix" value="/WEB-INF/output/"/>
<property name="suffix" value=".jsp"/>
</bean>
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
</beans>
我的SMAC应用部署细被映射。
因此,如果我要求http://127.0.0.1:8080/smac/info.xhtml,Spring-MVC应该返回/WEB-INF/output/info.jsp。但我所看到的控制台以下:
没有映射发现HTTP请求的URI与[/smac/info.xhtml在DispatcherServlet的名称为“控制器”
谁能帮助我?
问候,