org.apache.beehive.netui.pageflow.annotations
Annotation Type Jpf.Action


@Target(value=METHOD)
@Retention(value=RUNTIME)
public static @interface Jpf.Action

Method-level annotation that configures an action method. This annotation is required for a method to be recognized as an action. Nearly every action will define a list of forwards through the forwards() attribute. An example of an action method is shown below:

@Jpf.Action(
    forwards={
        @Jpf.Forward(name="page1", page="page1.jsp"),
        @Jpf.Forward(name="page2", page="page2.jsp")
    },
    validationErrorForward=@Jpf.Forward(name="failure", navigateTo=Jpf.NavigateTo.currentPage)
)
public Forward someAction(MyFormBean bean)
{
    if (...)
        return new Forward("page1");
    else
        return new Forward("page2");
}

For actions that do not require Java code (for example, a begin action that simply forwards to a particular page), Jpf.SimpleAction can be used instead.

See Also:
Jpf.SimpleAction

Optional Element Summary
 Jpf.Catch[] catches
          Array of declarative catches, which can reroute to a page or to a handler method (Jpf.ExceptionHandler) when a particular exception is thrown.
 boolean doValidation
          Enable or disable form validation for this action.
 Jpf.Forward[] forwards
          Array of Forwards that can be used from this action.
 boolean loginRequired
          If set to true, a NotLoggedInException will be thrown for this action when the current LoginHandler returns null for getUserPrincipal.
 boolean preventDoubleSubmit
           Use a session-scoped token to prevent multiple submits to this action.
 boolean readOnly
          If set to true, then by default this action has "promised" that it will not modify member data.
 String[] rolesAllowed
          Array of roles allowed to access this action.
 String useFormBean
          If set, then the form bean for this action method will be the named member variable, rather than a newly-created instance.
 Jpf.ValidatableProperty[] validatableProperties
          Array of validation rules that are applied to properties on this action's form bean.
 Jpf.Forward validationErrorForward
          The Forward used when form bean validation fails.
 

catches

public abstract Jpf.Catch[] catches
Array of declarative catches, which can reroute to a page or to a handler method (Jpf.ExceptionHandler) when a particular exception is thrown.

Default:
{}

doValidation

public abstract boolean doValidation
Enable or disable form validation for this action. If validationErrorForward() is set while doValidation is not, then validation is enabled automatically.

Default:
false

forwards

public abstract Jpf.Forward[] forwards
Array of Forwards that can be used from this action. The method uses a forward by returning a Forward object whose name matches the one in the Forward annotation. When an action method returns null, no forwarding is done.

Default:
{}

loginRequired

public abstract boolean loginRequired
If set to true, a NotLoggedInException will be thrown for this action when the current LoginHandler returns null for getUserPrincipal. The default LoginHandler simply calls getUserPrincipal on HttpServletRequest.

Default:
false

preventDoubleSubmit

public abstract boolean preventDoubleSubmit

Use a session-scoped token to prevent multiple submits to this action. When the server detects a double submit on the token, a DoubleSubmitException is thrown.

This is a server-side solution that guards against double processing; however, it is still a good idea to supplement this with a client-side solution to prevent double-submits from happening in the first place (an example of this is the disableSecondClick attribute on the NetUI Button tag, which disables the button through JavaScript as soon as it is pressed).

Default:
false

readOnly

public abstract boolean readOnly
If set to true, then by default this action has "promised" that it will not modify member data. In containers that support clustering, this allows the framework to avoid serializing the controller instance for session failover after the action is run. This is a performance optimization; it does not have an effect on the behavior of the action itself.

Default:
false

rolesAllowed

public abstract String[] rolesAllowed
Array of roles allowed to access this action. If this array is non-empty, then two exceptions may be thrown when the action is raised:

Default:
{}

useFormBean

public abstract String useFormBean
If set, then the form bean for this action method will be the named member variable, rather than a newly-created instance. This is referred to as a "flow-scoped form bean". Note that if the member variable is null, it will be set with a new instance of the correct type.

Default:
""

validatableProperties

public abstract Jpf.ValidatableProperty[] validatableProperties
Array of validation rules that are applied to properties on this action's form bean.

See Also:
Jpf.ValidateRequired, Jpf.ValidateMinLength, Jpf.ValidateMaxLength, Jpf.ValidateMask, Jpf.ValidateType, Jpf.ValidateDate, Jpf.ValidateRange, Jpf.ValidateCreditCard, Jpf.ValidateEmail, Jpf.ValidateValidWhen, Jpf.ValidateCustomRule
Default:
{}

validationErrorForward

public abstract Jpf.Forward validationErrorForward
The Forward used when form bean validation fails. Setting this value automatically enables validation for this action method, unless doValidation() is set to false. Validation is always disabled when this value is not set.

Default:
@org.apache.beehive.netui.pageflow.annotations.Jpf.Forward(name="")