EGL provides two ways to navigate to another page: forward to URL and forward to label, the default. When using forward to URL, you specify an absolute or relative URL to the target page; when using forward to label, you specify a navigation rule that in turn points to the target page. When navigating among pages in an EGL applications, use forward to label; when navigating to a web page in a different application, use forward to URL.
The JSF servlet responds to a forward statement by issuing either a forward or a redirect. A JSF redirect prompts the user's web browser to load a different target page; the effect is the same as if the user had typed the new URL into the browser's address bar, including the loss of any request information that was passed to the first page. A JSF forward, not to be confused with an EGL forward statement, loads the new page in the browser without indicating to the browser that the location has changed. In the case of the JSF forward, the browser believes that it is still at the original page location, though it is displaying the new target page. In this case, the request information is available to the new target page. However, the browser and servlet are out of sync, because the browser is not viewing the same page that it requested from the servlet. This mismatch can cause problems; for example, relative links to files such as images and stylesheets must be relative to the original page, rather than the forwarded target page, because the browser will interpret the links relative to the original page.
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.
When navigating from page to page within an EGL application, use forward to label. To forward the user from one page to another, you must know the name of the JSF navigation rule that points to the target page. By default, the name of the navigation rule that points to a page is the same as the name of the JSF Handler that manages that page.
forward to label "myPage";
<navigation-case>
<from-outcome>myPage</from-outcome>
<to-view-id>/myPage.jsp</to-view-id>
</navigation-case>
The navigation rule contains two
strings: a label for the rule and a relative link to the target page.
In this case, the label is myPage and the link refers
to a page named myPage.jsp in the same directory as the page that
used the navigation rule. Note the beginning slash before the file
name of the page, which is a requirement for the navigation rule.
This navigation rule will result in a JSF forward as described above.<navigation-case>
<from-outcome>myPage02</from-outcome>
<to-view-id>/../myProject02/myPage02.jsp</to-view-id>
<redirect/>
</navigation-case>
The <redirect/> tag
is required for a navigation rule pointing to a target page in a different
project. JSF uses a redirect rather than a forward when navigating
from a page in one project to a page in another project.forward to URL "http://www.ibm.com";
forward to URL "../myPage02.jsp";
forward to URL "/myProject02/myPage02.jsp";
When forwarding to another page controlled by an EGL JSF Handler, be sure to use the correct extension of .faces or .jsp, as explained in Running a web page on a server.