Click
  1. Click
  2. CLK-536

setRedirect() to support parameters too.

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Please extend the setRedirect() methods to support parameters too.
      Right now it is possible to use parameters only by manually creating the redirect location(and using the String version of the method). This is however very error prone.
      Please extend the two existing methods:
      setRedirect(String location) and
      setRedirect(Class pageClass)

      with a "params" parameter, e.g.
      setRedirect(String location, Map params) and
      setRedirect(Class pageClass, Map params

      to work for the very required case when the destination requires parameters.

      thanks,
      Joseph.

        Activity

        Hide
        Malcolm Edgar added a comment -

        Thanks for the Javadoc.

        I am not keen to add the single parameter methods as we will get a proliferation of methods on this class.

        regards Malcolm Edgar

        Show
        Malcolm Edgar added a comment - Thanks for the Javadoc. I am not keen to add the single parameter methods as we will get a proliferation of methods on this class. regards Malcolm Edgar
        Hide
        Adrian A. added a comment -

        This new patch contains some javadocs now.

        I could also add 2 new methods:
        setRedirect(String path, String paramName, String paramValue)
        setRedirect(Class page, String paramName, String paramValue)
        for the cases where a single parameter is used.

        Using setRedirect(DetailPage.class, new HashMap()put("customer", id););
        looks a little bit complicated for newbies (if they want to have a concise usage), although IDEs these days autocomplete it quickly and correctly.

        Show
        Adrian A. added a comment - This new patch contains some javadocs now. I could also add 2 new methods: setRedirect(String path, String paramName, String paramValue) setRedirect(Class page, String paramName, String paramValue) for the cases where a single parameter is used. Using setRedirect(DetailPage.class, new HashMap() put("customer", id); ); looks a little bit complicated for newbies (if they want to have a concise usage), although IDEs these days autocomplete it quickly and correctly.
        Hide
        Malcolm Edgar added a comment -

        Thanks for the patch Adrian, could you provide another patch with some Javadoc for the new Page methods.

        regards Malcolm Edgar

        Show
        Malcolm Edgar added a comment - Thanks for the patch Adrian, could you provide another patch with some Javadoc for the new Page methods. regards Malcolm Edgar
        Hide
        Joseph Schmidt added a comment -

        Thank you for the patch .

        For the case of a single parameter, I use this pattern now:
        setRedirect(DetailPage.class, new HashMap()put("customer", id););

        It not that nice(Java doesn't have a nice syntax for HashMaps like other popular languages), but it's one line only, and the IDE helps complete it very quickly.

        Show
        Joseph Schmidt added a comment - Thank you for the patch . For the case of a single parameter, I use this pattern now: setRedirect(DetailPage.class, new HashMap() put("customer", id); ); It not that nice(Java doesn't have a nice syntax for HashMaps like other popular languages), but it's one line only, and the IDE helps complete it very quickly.
        Hide
        Adrian A. added a comment -

        Here's a small patch that I use when I need redirect with parameters.

        Show
        Adrian A. added a comment - Here's a small patch that I use when I need redirect with parameters.
        Hide
        Malcolm Edgar added a comment -

        +1

        I think this would be a useful addition.

        Show
        Malcolm Edgar added a comment - +1 I think this would be a useful addition.

          People

          • Assignee:
            Malcolm Edgar
            Reporter:
            Joseph Schmidt
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development