Próbuję uruchomić pierwszą instalację Spring 3 MVC.Konfiguracja Spring MVC: PageNotFound przy użyciu InternalResourceViewResolver
Moja aplikacja jest uruchomiona na Tomcat, w kontekście serwera „pocztą pantoflową”
Dla celów testowania, próbuję dostać się do żądania od http://localhost:8080/grapevine/test
renderowania zawartości WEB-INF/jsp/noSuchInvitation.jsp
When staram się to, dostaję 404
i dzienniki wskazują, że moja JSP nie jest obecna:
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'
muszę mieć błędnie skonfigurowany to gdzieś, ale nie mogę zobaczyć, co zrobiłem źle.
Oto wszystkie istotne fragmenty.
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>
Z mojego kontekstu:
<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
Kontroler:
@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
Czy jesteś pewien, że nie ma błędów w pisowni? –
możliwy duplikat [Brak odwzorowania dla żądania HTTP z identyfikatorem URI \ [/WEB-INF/pages/apiForm.jsp \]] (http://stackoverflow.com/questions/1266303/no-mapping-found-for-http -request-with-uri-web-inf-pages-apiform-jsp) – naXa