@jpf:action Annotation

You can use the @jpf:action annotation to designate an action method in a page flow. Action methods in a page flow perform control logic, such as forwarding the user to a new JSP or another page flow. Optionally, you can cause an action to read and update from a FormData (or ActionForm) member variable; set login requirements for users; or indicate that the action method will not update any member data in the page flow.

For information about the method signatures of an action method, see the @jpf:forward Annotation. That topic also describes the run-time behavior of overloaded actions, in the Remarks section.

Syntax

@jpf:action

[ form = "<form name>" ]

[ login-required = "{ true | false }"

[ read-only = "{ true | false }" ]

[ roles-allowed = "<J2EE role name> [ , <J2EE role name> ] " ] 

Attributes

form

Optional. A Form Bean instance that will be passed to the method. For more information, see the Remarks section.

login-required

Optional. A boolean that indicates whether the user must be logged-in to use this action method. If set to login-required="true" the action method can only be run if the user is logged in. That is, the page flow runtime checks to see if request.getUserPrincipal() == null. If it is, then the exception com.bea.wlw.netui.pageflow.NotLoggedInException is thrown and the code in the action method is not executed. You can catch the exception in the page flow or the web project's Global.app, and from there attempt to log the user in.

When you create a new "Web Project" project with WebLogic Workshop, a default Global.app file is created for you in the project's /WEB-INF/src/global directory. Global.app allows you to define actions that can be invoked by any other page flow in a web application. In Global.app, you can catch and handle exceptions that were not caught in your page flow. For more information, see Handling Exceptions in Page Flows.

read-only

Optional. The default is read-only="false". Use this attribute to indicate your intention that this action will not update any member data in the page flow. In a WebLogic cluster environment, this designation causes WebLogic Workshop to skip any attempted failover of the pageflow after the action is run. This option may allow you to increase the performance of the page flow in cluster environments, by making it unnecessary for WebLogic Workshop to communicate portions of this page flow's state data across the nodes in the cluster that pertain to the read-only actions.

roles-allowed

Optional. Specifies the name of one or more security roles that are defined in the web project's /WEB-INF/web.xml file. If more than one security role name is specified, use a comma to separate each name. For more information on security roles, see the Role-Based Security.

If roles-allowed is defined, the use of this action method will be limited to logged-in users who are associated with at least one of the specified roles specified at this method-level, or one of the security roles specified on the class-level annotation @jpf:controller (if used). That is, security roles that are specified at the method level with @jpf:action add to any allowable roles defined at the class level with @jpf:controller. If the user is not logged-in, a com.bea.wlw.netui.pageflow.NotLoggedInException will be thrown. If the user is not in an appropriate role, a com.bea.wlw.netui.pageflow.UnfulfilledRolesException will be thrown. For more information, see Handling Exceptions in Page Flows.

validation-error-page (Deprecated)

This attribute on @jpf:action has been deprecated, as of WebLogic Workshop 8.1 Service Pack 2. Instead you can use the @jpf:validation-error-forward Annotation.

Remarks

The following rules apply to this annotation's use:

Related Topics

@jpf:catch Annotation

@jpf:controller Annotation

@jpf:exception-handler Annotation

@jpf:forward Annotation

@jpf:message-resources Annotation

@jpf:validation-error-forward Annotation

Form Bean Scopings

Samples

Data Flow Sample