Previous Next vertical dots separating previous/next from contents/index/pdf

How to Define an Action that Forwards Users to Another Page

This topic explains how to setup navigation between two JSP pages using a navigational action in a page flow Controller class.

These instructions assume that you have a dynamic web project (New > Project > Other > Web > Dynamic Web Project) that contains a page flow with at least two JSP pages.

To Create the Navigational Action

  1. Open the Page Flow perspective (Window > Open Perspective > Page Flow).
  2. Right-click in the center pane of the Page Flow Editor and select New Action.
  3. In the New Action dialog, in the Action Template field, confirm that Basic Method Action is selected.
    In the Action Name field, enter an appropriate name for the action. This will be the name of the action method.
    In the Forward To field, select the destination JSP page. (This is the page that users will navigate to.)
    Click Finish.

To Create a Link that Invokes the Navigational Action

  1. Open the JSP page that will invoke the action. This is the starting page that users will navigate from.
  2. On the JSP Design Palette, expand the NetUI category by clicking the heading or the + sign. Under the NetUI heading, drag and drop the anchor icon onto the starting JSP page.
  3. In the New Anchor dialog, in the Anchor Type dropdown, confirm that Action is selected.
    In the Text field, enter some appropriate text. This is the display text for the hyperlink.
    In the Action dropdown, select the action method you created above.
    Click Ok.

In the Page Flow Editor there should be two arrows: (1) an arrow pointing from the starting JSP page to the action method and (2) another arrow pointing from the action method to the destination JSP page.

The source code you have created should look something like the following:


    <netui:anchor action="navAction">Navigate to destination.jsp!</netui:anchor>

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "destination.jsp") })
    public Forward navAction() {
        Forward forward = new Forward("success");
        return forward;

Related Topics

Page Flow Editor

New Action

JSP Design Palette


Skip navigation bar   Back to Top