Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2842

Wildcards in namespace maps url values to controller parameters

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: Plugin - REST
    • Labels:
      None

      Description

      Implement wildcard functionality in namespace declaration to be able to map URL values to controller properties, or more appropriately, push them to the value stack.

      This has been discussed lightly on the user mailing list and there is a short notice on the jroller blog by Don Brown http://www.jroller.com/mrdon/entry/struts_2_rest_todos .

      Simple example:

      We may want to map a nice and clean url: GET /report/lbroman/2008/january
      To a ReportController where the values lbroman, 2008, january will be set on properties on the Controller.
      Using the @Namespace annotation, a namespace declaration like "/report/

      {user}

      /

      {year}

      /

      {month}

      " will use the wildcard mapping to map "lbroman", "2008", "january" to setUser(), setYear() and setMonth() respectively.

      Note that this overrides the default setId() for the first parameter.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lbroman Leonard Broman
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: