I'm trying to get a first Spring 3 MVC setup running.
My app is running on tomcat, with in the server context of "grapevine"
For the purposes of testing, I'm trying to get requests from http://localhost:8080/grapevine/test
to render the contents of WEB-INF/jsp/noSuchInvitation.jsp
When I try this, I'm getting a 404
, and the logs suggest that my jsp isn't present:
WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/grapevine/WEB-INF/jsp/noSuchInvitation.jsp] in DispatcherServlet with name 'grapevine'
I must have mis-configured this somewhere, but I can't see what I've done wrong.
Here's all the relevant snippets.
Web.xml:
<servlet>
<servlet-name>grapevine</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>grapevine</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
From my context:
<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
Controller:
@Controller
public class ParticipantInvitationController {
@RequestMapping("/test")
public ModelAndView test()
{
return new ModelAndView("noSuchInvitation");
}
Log:
DEBUG org.springframework.web.servlet.DispatcherServlet - Rendering view [org.springframework.web.servlet.view.JstlView: name 'noSuchInvitation'; URL [/WEB-INF/jsp/noSuchInvitation.jsp]] in DispatcherServlet with name 'grapevine'
DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to resource [/WEB-INF/jsp/noSuchInvitation.jsp] in InternalResourceView 'noSuchInvitation'
DEBUG org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'grapevine' processing GET request for [/grapevine/WEB-INF/jsp/noSuchInvitation.jsp]
WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/grapevine/WEB-INF/jsp/noSuchInvitation.jsp] in DispatcherServlet with name 'grapevine'
DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository - SecurityContext contents are anonymous - context will not be stored in HttpSession.
DEBUG org.springframework.web.servlet.DispatcherServlet - Successfully completed request
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…