Announcement Announcement Module
Collapse
No announcement yet.
adding parameters to a RedirectView... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • adding parameters to a RedirectView...

    I have a controller that extends SimpleFormController. It's onSubmit method currently returns the following value:

    Code:
    return new ModelAndView(new RedirectView(this.getSuccessView()));
    How would I go about adding a parameter (from the onSubmit method) to the resulting URL?

    My current success view is: doSomething.html

    I need it do be: doSomething.html?myParam=somethingDynamic

    A (hackish) way to do it would be:

    Code:
    String view = this.getSucccessView() + "?myParam=" + myParam;
    return new RedirectView(view);
    I'm wondering if there's a better way...

    Thanks,
    Brian Kuhn

  • #2
    Re: adding parameters to a RedirectView...

    Brian,

    Given:

    protected void appendQueryProperties(StringBuffer targetUrl,
    Map model,
    String encodingScheme)
    throws UnsupportedEncodingException

    on RedirectView try this:
    Code:
    Map model = new HashMap();
        model.put("param1", "value1");
        ...
        return new ModelAndView(new RedirectView(getSuccessView()), model);
    hope this helps.

    ATTA

    Originally posted by briankuhn
    I have a controller that extends SimpleFormController. It's onSubmit method currently returns the following value:

    Code:
    return new ModelAndView(new RedirectView(this.getSuccessView()));
    How would I go about adding a parameter (from the onSubmit method) to the resulting URL?

    My current success view is: doSomething.html

    I need it do be: doSomething.html?myParam=somethingDynamic

    A (hackish) way to do it would be:

    Code:
    String view = this.getSucccessView() + "?myParam=" + myParam;
    return new RedirectView(view);
    I'm wondering if there's a better way...

    Thanks,
    Brian Kuhn

    Comment


    • #3
      that worked...

      Thanks ATTA. That worked...

      Comment

      Working...
      X