My handler forwards to internalresourceview 'apiForm' but then i get error 404 RequestURI=/WEB-INF/pages/apiForm.jsp. I'm sure apiForm.jsp located in /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
this is how my dispatcher.xml look like..
<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>
Looks like DispatcherServlet is trying to process the request for apiForm.jsp, which suggests to me that your web.xml servlet-mapping is directing requests for that space to DispatcherServlet.
You might have something like this?
<servlet-mapping> <servlet>dispatcher</servlet> <url-pattern>/*</url-pattern> </servlet-mapping>
Try calling your controllers with a different extension (.do for example) and update the servlet-mapping to suit
<servlet-mapping> <servlet>dispatcher</servlet> <url-pattern>*.do</url-pattern> </servlet-mapping>
Yes, I know I'm late to this party but it might help others.
The servlet container chooses the mapping based on the longest path that matches. So you can put this mapping in for your JSPs and it will be chosen over the /* mapping.
<servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>/WEB-INF/pages/*</url-pattern> </servlet-mapping>
Actually for Tomcat that's all you'll need since jsp is a servlet that exists out of the box. For other containers you either need to find out the name of the JSP servlet or add a servlet definition like:
<servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> </servlet>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With