With dynamic page navigation, the application determines at runtime which page a specific component opens. The page that you navigate from is called the source page. The page that you navigate to is called the destination page. For dynamic navigation, the source page can open one of two or more destination pages. For example, the component's action method might look up a user's record, and if the user is an administrator, go to the Administrator page. If the user is not an administrator, it would go to the Welcome page.
To set dynamic navigation, you create the pages, and then you create the connectors, and then you code the conditional statement.
To create the pages:
To create the connectors:
To code the conditional statement:
return statement to the name of a single connector. To make the navigation dynamic, you code a conditional statement that returns different connectors based on a set of conditions. When a condition is satisfied, the button dynamically returns
the correct page.
For example:
Page1.jsp Button1Page2.jspPage3.jspPage1.jsp to Page2.jsp: Page2ConnectPage1.jsp to Page3.jsp: Page3Connect.gotoform2 is true, Page2.jsp opens.
Otherwise, Page3.jsp opens. If you double-click Button1 in Page1.jsp, the Java Editor
opens Page1.java with the cursor in the Button1_action method.
Replace the button's return statement with the following code:
if (gotoform2 == true) {
return "Page2Connect";
}
else return "Page3Connect";