I am creating a new project based on 3.1 M1 as a test case. I have my web.xml configured to use DispatcherServlet with the context class org.springframework.web.context.support.Annotation ConfigWebApplicationContext and contextConfigLocation domain.ApplicationConfiguration.
However, when a method from one of the annotated @Controller classes with attempts to return a ModelAndView with a name of the form "test" I, it searches for a method in the same controller class with @RequestMapping "test" when I would like it to look for jsp with the name " test.jsp "in the WebContent directory, and it looks like the viewresolver is never created. I tried declaring a view recognizer in the ApplicationConfiguration class, but it seems to be ignored. I always get a message in the log: WARNING. There is no mapping for an HTTP request with a URI [/ test / foo / test] in a DispatcherServlet named "dispatcher"
How to configure the recognizer in 3.1?
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <context-param> <param-name>contextClass</param-name> <param-value> org.springframework.web.context.support.AnnotationConfigWebApplicationContext </param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>domain.test.configuration.ApplicationConfiguration</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextClass</param-name> <param-value> org.springframework.web.context.support.AnnotationConfigWebApplicationContext </param-value> </init-param> <init-param> <param-name>contextConfigLocation</param-name> <param-value>domain.test</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <display-name>test</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app>
What other parts of the configuration will be useful?
source share