How do we access static parameters from an Action

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Code Block
<action name="myAction" class=" MyAction">
     <param name="myStaticParam1">myStaticValue1</param>
     <param name="myStaticParam2">myStaticValue2</param>
     <param name="myStaticParam3">myStaticValue3</param>
  </action>
  • Ensure that static-params staticParams Interceptor is included in the Action's stack.
    • (info) The default stack already includes static-params staticParams.
  • Edit the Action so that it implements the Parameterizable interface.

...

  • Ensure the Action defines a setParams(Map) method.
  • The static-params staticParams Interceptor will set the defined values to the Map, using the name as the entry key.

...

  • Ensure that the Action defines JavaBean properties corresponding to the param elements in the action mapping.
  • The static-params staticParams Interceptor will set the defined values to each JavaBean property that corresponds to a param element.

...