Announcement Announcement Module
Collapse
No announcement yet.
SimpleFormController redirect view adds unwanted parameters to URL? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleFormController redirect view adds unwanted parameters to URL?

    I have a SimpleFormController configured to redirect to another SimpleFormController. The first SFC looks like this:

    Code:
    	<bean name="/createAccount.do" class="p.CreateAccountFormController">
    		<property name="commandClass" value="p.UserInfo" /> 
    		<property name="formView" value="/WEB-INF/views/createAccount.jsp" />
    		<property name="successView" value="redirect:/answerQuestions.do" />
    	</bean>
    Whenever I submit the form, I am redirected to
    Code:
    https://localhost:8443/app/answerQuestions.do?org.springframework.validation.BindingResult.command=org.springframework.validation.BeanPropertyBindingResult%3A+0+errors&command=p.UserInfo%40789676
    Is there anyway to get rid of those parameters? Why are they there?

    Thanks,

  • #2
    By default, a redirect view will expose all model attributes as HTTP query parameters.

    You can either:

    a.) Place a new Map as the model in the ModelAndView returned by your controller.

    b.) Remove the "redirect:" from your successView and explicitly instantiate it as a redirect view in your controller w/ a flag to disable exposeModelAttributes. See API for RedirectView.

    Comment


    • #3
      I will try that out. Thanks!

      Comment

      Working...
      X