jgoodwin
Feb 8th, 2006, 05:29 PM
I am developing a simple Spring MVC application that consists of 2 simpleFormControllers. I basically need to request the 2nd simpleformcontroller from within the onSubmit of the first. I am doing so with the following code.
SubmitUserIdentificationController Code:
onSubmit{
return new ModelAndView(new RedirectView(getSuccessView(),true),
"model", model);
The springapp-servlet.xml file has the following config:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<props>
<prop key="/savequestions.htm">saveSecurityQuestionsForm</prop>
<prop key="/resetpwd.htm">userValidationForm</prop>
</props>
</property>
</bean>
<bean id="UserValidationRequestValidator" class="albany.edu.pwdmaint.controllers.validators.UserVal idationRequestValidator"/>
<bean id="userValidationForm" class="albany.edu.pwdmaint.controllers.SubmitUserIdentifi cationController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>userValidationRequest</value></property>
<property name="commandClass"><value>albany.edu.pwdmaint.model.UserValidationRequest</value></property>
<property name="validator"><ref bean="UserValidationRequestValidator"/></property>
<property name="formView"><value>resetpwd</value></property>
<property name="successView"><value>savequestions.htm</value></property>
<property name="dataAccessService" ref="dao"/>
</bean>
<bean id="saveSecurityQuestionsForm" class="albany.edu.pwdmaint.controllers.SubmitSecurityQues tionsController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>saveSecurityQuestionsRequest</value></property>
<property name="commandClass"><value>albany.edu.pwdmaint.model.SaveSecurityQuestionsReq uest</value></property>
<property name="formView"><value>saveSecurityQuestions</value></property>
<property name="successView"><value>resetpasswords</value></property>
<property name="dataAccessService" ref="dao"/>
</bean>
When the redirect occurs I receive a 404 stating that savequestions.htm.jsp does not exist. Shouldn't the redirect be mapped to the saveSecurityQuestionsForm? I am not sure what I have done wrong. My web.xml maps all *.htm requests to the Spring ServletDispatcher. Any help would be greatly appreciated.
SubmitUserIdentificationController Code:
onSubmit{
return new ModelAndView(new RedirectView(getSuccessView(),true),
"model", model);
The springapp-servlet.xml file has the following config:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<props>
<prop key="/savequestions.htm">saveSecurityQuestionsForm</prop>
<prop key="/resetpwd.htm">userValidationForm</prop>
</props>
</property>
</bean>
<bean id="UserValidationRequestValidator" class="albany.edu.pwdmaint.controllers.validators.UserVal idationRequestValidator"/>
<bean id="userValidationForm" class="albany.edu.pwdmaint.controllers.SubmitUserIdentifi cationController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>userValidationRequest</value></property>
<property name="commandClass"><value>albany.edu.pwdmaint.model.UserValidationRequest</value></property>
<property name="validator"><ref bean="UserValidationRequestValidator"/></property>
<property name="formView"><value>resetpwd</value></property>
<property name="successView"><value>savequestions.htm</value></property>
<property name="dataAccessService" ref="dao"/>
</bean>
<bean id="saveSecurityQuestionsForm" class="albany.edu.pwdmaint.controllers.SubmitSecurityQues tionsController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>saveSecurityQuestionsRequest</value></property>
<property name="commandClass"><value>albany.edu.pwdmaint.model.SaveSecurityQuestionsReq uest</value></property>
<property name="formView"><value>saveSecurityQuestions</value></property>
<property name="successView"><value>resetpasswords</value></property>
<property name="dataAccessService" ref="dao"/>
</bean>
When the redirect occurs I receive a 404 stating that savequestions.htm.jsp does not exist. Shouldn't the redirect be mapped to the saveSecurityQuestionsForm? I am not sure what I have done wrong. My web.xml maps all *.htm requests to the Spring ServletDispatcher. Any help would be greatly appreciated.