wmgildersleeve
May 6th, 2008, 04:23 PM
I'm porting a standard web/JSP application to Spring. I'm a newbie at Spring-MVC and, though I've gotten most of the app finished, am having trouble getting views to work. Specifically, Tomcat is saying that there's no mapping when trying to resolve a view.
So here's what I'm doing: the web.xml is using a catch-all URL mapping to pass all requests to a DispatcherServlet. The URL mappers are in my spring file, using SimpleUrlHandlerMapping. I've also configured an InternalResourceViewResolver like this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="prefix"><value>/WEB-INF/jsp/</value></property>
<property name="suffix"><value>.page</value></property>
<property name="alwaysInclude" value="true"/>
</bean>
In my hello world controller, I'm simply returning new ModelAndView("green"). Now Tomcat is giving me the error:
No mapping for [/batch/WEB-INF/jsp/green.page] in
DispatcherServlet with name 'dispatcherServlet'
Obviously the view is recognized, but instead of looking in the file system for the resource, it's doing a redirect. (Switching alwaysInclude to true was my naive attempt to resolve this--I get the same error if it's false.)
Any ideas? It works if I forsake the view resolver and add explicit mapping to the web.xml, but I'd rather use a catch-all and simply do a file system lookup.
This is using Tomcat 5.5 on Windows XP, Java 6.
So here's what I'm doing: the web.xml is using a catch-all URL mapping to pass all requests to a DispatcherServlet. The URL mappers are in my spring file, using SimpleUrlHandlerMapping. I've also configured an InternalResourceViewResolver like this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="prefix"><value>/WEB-INF/jsp/</value></property>
<property name="suffix"><value>.page</value></property>
<property name="alwaysInclude" value="true"/>
</bean>
In my hello world controller, I'm simply returning new ModelAndView("green"). Now Tomcat is giving me the error:
No mapping for [/batch/WEB-INF/jsp/green.page] in
DispatcherServlet with name 'dispatcherServlet'
Obviously the view is recognized, but instead of looking in the file system for the resource, it's doing a redirect. (Switching alwaysInclude to true was my naive attempt to resolve this--I get the same error if it's false.)
Any ideas? It works if I forsake the view resolver and add explicit mapping to the web.xml, but I'd rather use a catch-all and simply do a file system lookup.
This is using Tomcat 5.5 on Windows XP, Java 6.