Я пытаюсь получить первый Spring 3 Выполняется установка MVC.
Мое приложение запущено на tomcat, в контексте сервера "grapevine"
В целях тестирования я пытаюсь получить запросы от http: // localhost: 8080 / grapevine / test
, чтобы отобразить содержимое WEB-INF / jsp / noSuchInvitation. jsp
Когда я пробую это, я получаю 404
, а журналы предполагают, что моего 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'
Я, должно быть, неправильно это настроил, но могу ' Я не вижу, что я сделал не так.
Вот все соответствующие фрагменты.
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>
Из моего контекста:
<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
public class ParticipantInvitationController {
@RequestMapping("/test")
public ModelAndView test()
{
return new ModelAndView("noSuchInvitation");
}
Журнал:
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