我的处理程序转发到internalresourceview’apiForm’,但随后出现错误404 RequestURI = / WEB-INF / pages / apiForm.jsp。我确定apiForm.jsp位于/ WEB-INF / pages /
13:45:02,034 DEBUG [org.springframework.web.servlet.view.JstlView] - Forwarding to resource [/WEB-INF/pages/apiForm.jsp] in InternalResourceView 'apiForm' 13:45:02,035 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'testapp2' determining Last-Modified value for [/WEB-INF/pages/apiForm.jsp] 13:45:02,038 DEBUG [org.springframework.web.servlet.DispatcherServlet] - No handler found in getLastModified 13:45:02,038 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'testapp2' processing request for [/WEB-INF/pages/apiForm.jsp] 13:45:02,038 WARN [org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP request with URI [/WEB-INF/pages/apiForm.jsp] in DispatcherServlet with name 'testapp2' 13:45:02,045 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request 13:45:02,048 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request
这就是我的dispatcher.xml的样子。
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> </bean>
看起来DispatcherServlet正在尝试处理对apiForm.jsp的请求,这向我暗示你的web.xml Servlet映射正在将对该空间的请求定向到DispatcherServlet。
你可能会遇到这样的事情?
<servlet-mapping> <servlet>dispatcher</servlet> <url-pattern>/*</url-pattern> </servlet-mapping>
尝试使用其他扩展名(例如,.do)调用控制器,并更新servlet映射以适合
<servlet-mapping> <servlet>dispatcher</servlet> <url-pattern>*.do</url-pattern> </servlet-mapping>