Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-65

Handle String array in PageParameters

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0-beta2
    • wicket
    • None

    Description

      When building PageParameters, it is possible to repeat
      the same parameter name to build a string array, this
      is documented here:

      http://wicket.sourceforge.net/apidocs/wicket/util/value/ValueMap.html#add(java.lang.String,%20java.lang.String)

      However when issuing setResponsePage(MyPage.class,
      params) the newly constructed URL does not honour the
      string array parameter, only the first value is used.

      Example:

      PageParameters params = new PageParameters();
      params.add("a", "1");
      params.add("a", "2");

      This builds a parameter that is a String[] with name
      "a" and values: ["1", "2"]. But the URL shown in the
      browser is: http://server/app?a=1 instead of
      http://server/app?a=1&a=2

      Note that in the target page I'm using
      params.getStringArray("a") to get the string array.

      Please find attached a patch against branch wicket-1.x
      that adresses the URL encoding issue. The patch also
      refactors the URL encoding logic to have a more readable
      and compact code.

      Thanks in advance!

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            almaw Alastair Maw
            jbq Jean-Baptiste Quenot
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment