org.apache.struts2.convention.annotation
Annotation Type ParentPackage


@Target(value={TYPE,PACKAGE})
@Retention(value=RUNTIME)
public @interface ParentPackage

This annotation allows actions to modify the parent package that they are using. Since XWork packages are created by the Convention plugin via the Java packages that the actions exist in, there is some tricky handling of XWork parent packages and namespaces of the XWork packages for discovered actions so that two actions in the same package can specify different parents and namespaces without collision.

In order to handle this correctly, the name of the XWork package that actions are placed into is built using this format:

 <java-package>#<parent-xwork-package>#<namespace>
 

This mechanism will guarantee that two actions in the same Java package can specify different parent packages (using this annotation) and namespaces (using the Namespace annotation).

This annotation can be used directly on Action classes or in the package-info.java class in order to specify the default XWork parent package for all actions in the Java package. The search order for XWork parent packages is therefore:

  1. Any ParentPackage annotations placed on individual action classes
  2. Any ParentPackage annotations placed in the package-info.java file
  3. The struts configuration property struts.convention.default.parent.package


Required Element Summary
 java.lang.String value
           
 

Element Detail

value

public abstract java.lang.String value
Returns:
The parent package.


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.