Hi.
I seem to be missing something simple. I'm getting an HTTP 404 error upon redirecting to my successView after successful processing of the form controller's onSubmit method.
I'm hooking up Spring to an existing JSP-based website. I have mapped the SpringDispatcher servlet to /dyn/* in my WEB-INF/web.xml:I have a SimpleFormController subclass called RegistrationFormController. Here's my whole spring-servlet.xml:Code:<servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/spring-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/dyn/*</url-pattern> </servlet-mapping>The problem that I'm having is that upon successful processing of my form in the RegistrationFormController.onSubmit method, Spring can't seem to find my view JSP, located at WEB-INF/jsp/registered.jsp. Here's my onSubmit method:Code:<beans> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property> <property name="prefix"><value>/WEB-INF/jsp/</value></property> <property name="suffix"><value>.jsp</value></property> </bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename"><value>messages</value></property> </bean> <bean id="registrationCommandValidator" class="xcalia.xdn.site.RegistrationCommandValidator"/> <bean id="registrationFormController" class="xcalia.xdn.site.RegistrationFormController"> <property name="sessionForm"><value>true</value></property> <property name="commandName"><value>registrationCommand</value></property> <property name="commandClass"><value>xcalia.xdn.site.RegistrationCommand</value></property> <property name="validator"><ref bean="registrationCommandValidator"/></property> <property name="formView"><value>registrationform</value></property> <property name="successView"><value>redirect:registered</value></property> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/register">registrationFormController</prop> </props> </property> </bean> </beans>I thought that my InternalResourceViewResolver should be able to find the view, but it's not, and I'm getting an HTTP 404 error. Here's a portion of the DEBUG-level the log:Code:protected ModelAndView onSubmit( HttpServletRequest request, HttpServletResponse response, Object commandObject, BindException bindException) throws Exception { RegistrationCommand rc = (RegistrationCommand) commandObject; UUIDGenerator uuidGenerator = UUIDGenerator.getInstance(); UUID uuid = uuidGenerator.generateTimeBasedUUID(); String confirmationCode = uuid.toString(); request.getSession().setAttribute("registrationCommand", rc); request.getSession().setAttribute("confirmationCode", confirmationCode); // using RedirectView to ensure that double-posting can't be configured accidentally return new ModelAndView(new RedirectView(getSuccessView(), true)); }Can someone please tell me what I'm missing?Code:2005-07-19 09:39:12,877 DEBUG [org.springframework.web.servlet.view.JstlView] - <Forwarded to resource [/WEB-INF/jsp/registrationform.jsp] in InternalResourceView 'registrationform'> 2005-07-19 09:39:12,877 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Successfully completed request> 2005-07-19 09:39:12,877 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] - <Publishing event in context [WebApplicationContext for namespace 'spring-servlet']: RequestHandledEvent: url=[/dyn/register]; time=[0ms]; client=[127.0.0.1]; method=[GET]; servlet=[spring]; session=[51C1D65FBA95F3CE98417329F3E58715]; user=[null]; status=[OK]> 2005-07-19 09:39:40,436 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <DispatcherServlet with name 'spring' received request for [/dyn/register]> 2005-07-19 09:39:40,436 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@4e7958] in DispatcherServlet with name 'spring'> 2005-07-19 09:39:40,436 DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - <Looking up handler for [/register]> 2005-07-19 09:39:40,436 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@cb6a34]> 2005-07-19 09:39:40,446 DEBUG [org.springframework.beans.CachedIntrospectionResults] - <Using cached introspection results for class [xcalia.xdn.site.RegistrationCommand]> 2005-07-19 09:39:40,446 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void ... (snip) [org.springframework.validation.ValidationUtils] - <Invoking validator [xcalia.xdn.site.RegistrationCommandValidator@146ac5a]> 2005-07-19 09:39:40,466 DEBUG [org.springframework.validation.ValidationUtils] - <Validator found no errors> 2005-07-19 09:39:40,476 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Rendering view [org.springframework.web.servlet.view.RedirectView: unnamed; URL [registered]] in DispatcherServlet with name 'spring'> 2005-07-19 09:39:40,476 DEBUG [org.springframework.web.servlet.view.RedirectView] - <Rendering view with name 'null' with model null and static attributes {}> 2005-07-19 09:39:40,486 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Successfully completed request> 2005-07-19 09:39:40,486 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] - <Publishing event in context [WebApplicationContext for namespace 'spring-servlet']: RequestHandledEvent: url=[/dyn/register]; time=[50ms]; client=[127.0.0.1]; method=[POST]; servlet=[spring]; session=[51C1D65FBA95F3CE98417329F3E58715]; user=[null]; status=[OK]> 2005-07-19 09:39:40,497 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@4e7958] in DispatcherServlet with name 'spring'> 2005-07-19 09:39:40,497 DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - <Looking up handler for [/registered]> 2005-07-19 09:39:40,507 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <No handler found in getLastModified> 2005-07-19 09:39:40,507 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <DispatcherServlet with name 'spring' received request for [/dyn/registered]> 2005-07-19 09:39:40,507 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@4e7958] in DispatcherServlet with name 'spring'> 2005-07-19 09:39:40,507 DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - <Looking up handler for [/registered]> 2005-07-19 09:39:40,507 WARN [org.springframework.web.servlet.PageNotFound] - <No mapping for [/dyn/registered] in DispatcherServlet with name 'spring'> 2005-07-19 09:39:40,507 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Successfully completed request> 2005-07-19 09:39:40,507 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] - <Publishing event in context [WebApplicationContext for namespace 'spring-servlet']: RequestHandledEvent: url=[/dyn/registered]; time=[0ms]; client=[127.0.0.1]; method=[GET]; servlet=[spring]; session=[51C1D65FBA95F3CE98417329F3E58715]; user=[null]; status=[OK]>
Thanks,
Matthew


Reply With Quote
