Before you begin, you must complete Lesson 1.1: Creating a Struts project.
A Web diagram is a file that helps you visualize and change the flow of a Web application such as a Faces or Struts-based application. In this Lesson, you will open the DayOfWeek Struts project's Web diagram, set the diagram's grid settings, and edit the diagram. The following terms pertain to Web diagrams:
When you create a Struts-enabled dynamic Web project, a Web diagram is automatically created but not opened. Follow these steps to open the diagram:
By default, a Web diagram has no alignment grid. You can display a grid and turn on the snap-to-grid option, which aligns the nodes in the diagram to the grid and organizes the Web diagram.
In this section, you will add nodes to the Web diagram that represent two Web pages, a form bean, and an action mapping. When you are finished, the Web diagram will look like the following image:
The new Web page node appears on your Web diagram with the default name page.jsp selected.
index.jsp
Tip: When you create a new node in a Web diagram, the name of that node is automatically selected so you can immediately type in a name for that node. If you click anywhere else, the name will no longer be selected. If you want to change the name of a node and it is not selected, right-click on the node and choose Rename from the popup menu.
output.jsp
computeDay
The Web diagram now shows an action mapping between the two Web pages named /computeDay. The Web diagram has added the forward slash mark to the name of the action mapping.
dateData
Leave the Form Bean Scope field set to request.
The Web diagram should now look like the following image:
Now that the nodes are placed on the Web diagram, the next step is to connect the nodes. When you are finished, the diagram will look like the following image:
Now, your mouse cursor is set up to create a connection between the next two nodes you click.
Now there is a line between your mouse cursor and the index.jsp node. This line represents a connection from the index.jsp page to another node.
There is now a dotted line from the index.jsp node to the /computeDay node, representing a connection between these two nodes.
Next, you will connect the computeDay action mapping to the output.jsp node with a local forward.
success
Naming the new local forward connection works the same way as naming the new nodes. When the connection is created, its name is selected and you can type it immediately. If you click somewhere else, the connection is no longer selected and you must right-click on it and choose Rename from the popup menu.
Finally, you will connect the computeDay action mapping to the index.jsp node with a local forward.
failure
The Web diagram should look like the following image:
Now you are ready to begin Lesson 1.3: Creating and editing a form bean.