Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The only example right now is in the showcase, where the person package uses the classpath scanning configuration.
  • Use the "actionPackages" filter init param for a comma-separated list of packages containing Action classes. The packages and their subpackages will be scanned.
Code Block
XML
XML
titleAnnotation Initialization actionPackages Filter Parameter

<filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  <init-param>
    <param-name>actionPackages</param-name>
    <param-value>com.foo.bar,com.baz.quux</param-value>
  </init-param>
</filter>
  • All classes in the designated packages that implement Action or end in "Action" are examined. The latter is to allow for POJO Actions that don't implement the Action interface.
    • We should probably add an action annotation, so that POJOs can itall with annotations.
  • The subpackage name makes the namespace, and the action class name makes the action name. If there is an "Action" suffix, it is dropped before creating the action name. Therefore, if the configured package is com.myapp.actions and the Action is com.myapp.actions.member.EditAction, you can access it via http://server/myapp/member/edit.action
  • Results are defined with the Result and Results annotations at the class level
  • The Namespace annotation overrides the namespace
  • The ParentPackage annotation has the XWork package (an XWork package is created per Java package) to extend the defined package. Multiple packages can be specified through annotations on multiple Actions in the package.

...