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

Easier linkage of auto-Detected actions to custom XWork packages

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.0.9
    • None
    • Plugin - CodeBehind
    • None

    Description

      There doesn't seem to be a good way to DRYly link all actions auto-detected by actionPackages to a arbitrary XWork package configured in struts.xml.

      Using an explicit @ParentPackage addresses this, but having to repeat this annotation in every action isn't DRY. Alternately forcing actions to extend some base class with said annotation isn't clean.

      The documentation mentions that auto-Detected packages use a portion of the action's java package to set the namespace, but it doesn't mention anything about setting the action's package. I've tried several permutations of java and xwork package names checking if I could get a match, but it doesn't seem like they connect (it would be nice if config-browser listed the XWork package to help debug this)

      A few possible solutions:
      a) allow some sort of "default-package-ref" in struts the XML to state which package auto-detected actions would be placedin (of couse @ParentPackage would override)

      b) allow an actionPackages setting at the package level rather than the application level, thus any actions detected in that java package would be assigned to the containing XWork package (still allowing the @ParentPackage override)

      Attachments

        Issue Links

          Activity

            People

              lukaszlenart Lukasz Lenart
              nielsene Eric D. Nielsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: