@jpf:validation-error-forward Annotation

You can use the @jpf:validation-error-forward annotation to indicate which page should be loaded, or which action should be run, if a form validation error occurs as a result of running the annotated action.

Note: Starting in WebLogic Workshop 8.1 Service Pack 2, this annotation replaces the deprecated validation-error-page attribute that was available on the @jpf:action annotation. The @jpf:validation-error-forward annotation's attributes provide a more flexible validation forwarding behavior; specifically, they allow you to indicate return-to="..." options, and they allow forwarding to non-local files.

Syntax

@jpf:validation-error-forward

name = "<forward name>"

{ path = "<path>"  |  return-action = "<action name>"  |  return-to = {"currentPage" | "previousPage" | "previousAction"}  }

{ return-form = "<form name>" |  return-form-type = "<form type>"  }

[ redirect = { "true" | "false" } ]

 

Attributes

name

Required. Specifies the name of the forward, which causes the navigation to occur.

path

You must specify only one of the following: this path attribute, or the return-action attribute, or one of the return-to attributes.  The path attribute is a string that maps to one of the following entities:

If the path begins with a protocol such as "http:" the page flow runtime will look outside of this web application for the resource, and it will automatically cause a redirect (rather than a server forward) to the resource. If the path begins with a forward slash, "/", the runtime will start at the web application's root directory to locate the resource. If the path omits the forward slash, "/", the reference is relative to the page flow's directory.

return-to

The return-to attribute always applies to the current page flow, whether it is a nested page flow or the main page flow. To return to an action in the “nesting” page flow use the return-action attribute.

The value for the return-to attribute must be a keyword, either "currentPage", or "previousPage", or "previousAction".

Note: To clarify the purpose of the return-to attribute, the keywords "page" and "action" were deprecated as of WebLogic Workshop 8.1 Service Pack 2. Instead of "page", the equivalent function is "previousPage". Instead of "action", the equivalent function is "previousAction".

If the value is "currentPage", the same JSP page is rendered again by the server, along with any updated data that occurred as a result of executing the annotated action method.

If the value is "previousPage", the page that was shown before the current page is rendered.

If the value is "previousAction", the previous action in the current page flow is run.

return-action

The return-action attribute, which is only valid in a nested page flow, causes control to return to the calling (or "nesting") page flow (leaving the current page flow), and then causes the specified action to be raised on the calling page flow.

return-form

Optional. The return-form attribute, which is only valid when used with the return-action attribute, causes the given page flow member variable to be attached to the returned Forward automatically.

return-form-type

Optional. The return-form-type attribute, which is only valid when used with the return-action attribute, is used in conjunction with the Forward that is returned. Forward takes the actual FormData instance as the second argument to its constructor. This attribute declares the type of the form bean that will be returned to the calling page flow.

Note: If multiple actions with the same name (such as "success") exist in the calling page flow, either the return-form-type value or the return-form member variable type will be used to determine the appropriate action.

redirect

Optional. A boolean, true or false. Default is false. When set to true, navigation causes a browser redirect to the specified destination. Redirecting is useful when you want to clear out any data that was attached to a request, or when it is important that the user's URL bar reflect the actual page that is displayed (instead of the action name). For details, see the Remarks section below.

Remarks

The following rules apply to this annotation's use:

Related Topics

Validating User Input

Form Validation Sample

@jpf:catch Annotation

@jpf:controller Annotation

@jpf:exception-handler Annotation

@jpf:forward Annotation

@jpf:message-resources Annotation

Getting Started with Page Flows