forward considerations for JSF

In the context of JSF, the EGL forward statement is used to pass control to a web page or to a navigation rule in the Faces configuration file of your web project. The Faces configuration file lists the rules and the pages to which those rules point. By convention, if you are forwarding to a JSF handler, the name of the rule is the same as the name of the JSF handler. The navigation rule might also point to a servlet, web page, or Java™ program. For more information, see Navigating among web pages with navigation rules.

The forward statement performs the following actions:
  1. Commits recoverable resources, closes files, and releases locks
  2. Forwards control to the specified navigation rule
  3. Ends the code that runs the forward statement

In the functions defined in the onConstructionFunction, onPreRenderFunction, or onPostRenderFunction properties of a JSF Handler, you can use forward to URL but not forward to label.

Syntax

Syntax diagram for the forward statement
parameter
A variable that is passed to the JSF handler or other page or program. The names of a parameter and its corresponding argument must be the same in all cases (the name is used as a key in storing and retrieving the argument value on the web application server). If you are passing parameters to a page handler, those parameters must be compatible with the arguments for the function specified by the onConstructionFunction property of the JSF handler. You cannot pass literals.
navigationRule
Specifies a navigation rule in the Faces configuration file (faces-config.xml), which in turn identifies the object to invoke, whether a JSP (usually one associated with an EGL JSF handler), an EGL program, a non-EGL program, or a servlet. The word label is optional, and navigationRule is a text expression.
pageURL
Specifies a URL and (if needed) a string of values used by the invoked JSF handler, VGWebTransaction program, or servlet. pageURL is a text expression. If the URL is absolute (includes a domain name), EGL implements the forward statement as an HTTP redirect. If the URL is relative (on the same server), EGL implements the forward statement as an HTTP dispatch unless the expression includes the -redirect keyword, as in the following example:
forward to URL "/TestProject/TestPage2.html -redirect";

Example

The following example transfers control to a navigation rule named "myPage" in the Faces configuration file. That rule in turn points to a JSF handler named myPage.jsp, which receives control.
forward to label "myPage";

Feedback