Annotation Type Namespace

public @interface Namespace

This annotation defines how actions can modify the namespace that they are added to. This overrides the behavior of the Convention plugin which by default uses the package names for namespaces. 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 the Convention plugin 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:


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

The value of a Namespace annotation should specify the portion of the action URL between the context path and the action name. For example:


This annotation can also be placed inside the special Java file named, which allows package level annotations. If this is used in this manner it changes the default namespace for all actions within that Java package. The search order for the namespace of a particular class is therefore:

  1. If the Action annotation exists within the action and specifies a full URI (i.e. it starts with a / character)
  2. Any Namespace annotations placed on individual action classes
  3. Any Namespace annotations placed in the file
  4. The namespace as determined using the Java package name and the standard convention based naming.

Required Element Summary
 java.lang.String value

Element Detail


public abstract java.lang.String value
The namespace value.

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