Adding Global and Local Forwards to a Struts Configuration
Struts allows forwards to be added to a Struts configuration as aliases for your JSP pages and other presentation elements. Forwards can be added to the global Struts configuration or locally to an action element within the Struts configuration.
Inserting a forward using the Struts configuration form editor
-
Open a Struts Configuration file using the Project Explorer.
-
In the Struts Config view of the Struts configuration form editor, you will see the list of Struts artifacts including the current list of Global Forwards. You can expand this list by clicking the plus sign (+) if it is collapsed.
-
Right-click the Global Forwards node and select New Forward.
-
Enter forward properties and the forward path through the resulting Forward Tag dialog.
-
Click OK to insert the forward into the opened Struts configuration file. The new forward will appear under the list of Global Forwards and can be modified by selecting the specific forward and updating the forward properties.
Note: Using this technique will insert a global forward by default. A local forward will only be inserted by right-clicking an action under the list of Action Mappings and selecting New Forward.
Inserting a forward from the Struts outline view
-
To insert a global forward from the Struts outline view
-
Expand the Global Forwards node under the Outline view.
-
Right-click and select New Forward from the pop-up menu on the Outline view.
-
Enter forward properties through the resulting Forward Tag dialog.
-
Click OK.
-
To insert a local forward from the Struts outline view
-
Expand the Action Mappings node under the Struts Outline view.
- Select a Struts Action in the Outline view. The action will simultaneously
be selected in the Source pane of the Struts Configuration Editor. This
action will also become the container for the newly inserted forward.
-
Right-click and select New Forward from the pop-up menu on the Outline view. Note: The Outline view allows you to open the pop-up menu and select the action at the same time.
-
Enter forward properties through the resulting Action Forward dialog.
-
Click Finish.
Inserting a forward from the Struts navigation editor
-
To insert a local forward from the Navigation pane
-
Expand the Action Mappings node under the Struts Outline view.
-
Select a Struts Action in the Outline view. From the struts
configuration editor, go to the Navigation pane. The selected
action should be active.
-
Right-click the action and select New Forward from the pop-up menu on the selected action.
-
Enter forward properties through the resulting Forward Tag dialog.
-
Click Ok.
Still need help? Post a question on the Workshop
newsgroup.