|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@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.
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. |
public abstract Jpf.Catch[] catches
Jpf.ExceptionHandler
)
when a particular exception is thrown.
public abstract boolean doValidation
validationErrorForward()
is set while
doValidation
is not, then validation is enabled automatically.
public abstract Jpf.Forward[] forwards
Forward
object whose name matches the one in the Forward
annotation. When an action method returns null
, no forwarding is done.
public abstract boolean loginRequired
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
.
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).
public abstract boolean readOnly
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.
public abstract String[] rolesAllowed
NotLoggedInException
will be thrown when the current
LoginHandler
returns null
for
getUserPrincipal
. The default LoginHandler simply calls
getUserPrincipal
on HttpServletRequest
.
UnfulfilledRolesException
will be thrown when the
current LoginHandler
returns
false
from isUserInRole
for each of the roles in the list. The
default LoginHandler simply calls isUserInRole
on
HttpServletRequest
.
public abstract String useFormBean
public abstract Jpf.ValidatableProperty[] validatableProperties
Jpf.ValidateRequired
,
Jpf.ValidateMinLength
,
Jpf.ValidateMaxLength
,
Jpf.ValidateMask
,
Jpf.ValidateType
,
Jpf.ValidateDate
,
Jpf.ValidateRange
,
Jpf.ValidateCreditCard
,
Jpf.ValidateEmail
,
Jpf.ValidateValidWhen
,
Jpf.ValidateCustomRule
public abstract Jpf.Forward validationErrorForward
doValidation()
is set to false
. Validation is always
disabled when this value is not set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |