You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by st...@apache.org on 2005/05/25 00:03:41 UTC
svn commit: r178298 - in
/incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs:
controls/tutorial_controls.xml pageflow/tutorial_pageflow.xml
Author: steveh
Date: Tue May 24 15:03:41 2005
New Revision: 178298
URL: http://svn.apache.org/viewcvs?rev=178298&view=rev
Log:
Fix for BEEHIVE-763:expand the topics covered in the page flow tutorial
New tutorial steps contributed by Carlin Rogers.
Modified:
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/controls/tutorial_controls.xml
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml
Modified: incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/controls/tutorial_controls.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/controls/tutorial_controls.xml?rev=178298&r1=178297&r2=178298&view=diff
==============================================================================
--- incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/controls/tutorial_controls.xml (original)
+++ incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/controls/tutorial_controls.xml Tue May 24 15:03:41 2005
@@ -271,7 +271,7 @@
<section id="test_2">
<title>To Test the Control</title>
<p>Open a web browser and enter the following in the address bar:</p>
- <p class="quote"><a class="fork" href="http://localhost:8080/control_tutorial/Controller.jpf">http://localhost:8080/control_tutorial/Controller.jpf</a></p>
+ <p class="quote"><a class="fork" href="http://localhost:8080/control_tutorial/begin.do">http://localhost:8080/control_tutorial/begin.do</a></p>
<p>You will be directed to the index.jsp page.</p>
<p>Note the message on the page: "hello!"</p>
<p>This message is provided by the Hello control.</p>
@@ -375,7 +375,7 @@
<section id="test_3">
<title>To Test the Control</title>
<p>Open a web browser and enter the following in the address bar:</p>
- <p class="quote"><a class="fork" href="http://localhost:8080/control_tutorial/Controller.jpf">http://localhost:8080/control_tutorial/Controller.jpf</a></p>
+ <p class="quote"><a class="fork" href="http://localhost:8080/control_tutorial/begin.do">http://localhost:8080/control_tutorial/begin.do</a></p>
<p>You will be directed to the index.jsp page.</p>
<p>Note the messages on the page: "hello!" and "Hello, World!"</p>
<p>These messages are provided by the Hello control.</p>
Modified: incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml?rev=178298&r1=178297&r2=178298&view=diff
==============================================================================
--- incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml (original)
+++ incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml Tue May 24 15:03:41 2005
@@ -16,6 +16,9 @@
<li>how to handle data submission and processing with data binding and Form Beans.</li>
<li>how to create a user interface with the <netui> JSP tag library.</li>
<li>how Page Flows help to separate data processing and data presentation.</li>
+ <li>how to use declarative validation with data submission.</li>
+ <li>how to collect data from a nested Page Flow and 'return' it to the nesting Page Flow.</li>
+ <li>how to make an action available to multiple Page Flows.</li>
</ul>
</section>
</section>
@@ -111,8 +114,8 @@
<p>
In terms of the Model-View-Controller paradigm for web applications, the Controller.java
file is the Controller (naturally) and the JSP pages are the View. The web application's
- Model in this tutorial is very simple: it consists of two fields that represent the
- user's age and name.
+ Model in this tutorial is very simple: it consists of three fields that represent the
+ user's name, age and selected sport activity.
<!--[tbd: more, explain]-->
</p>
<p>
@@ -159,10 +162,14 @@
<p>We have used the Simple Action syntax for the sake of syntactical simplicity.
The Simple Action will forward the user to the JSP, index.jsp.</p>
<p>The Controller class is instantiated when a user calls it via the URL:</p>
- <source>http://localhost:8080/pageflow_tutorial/Controller.jpf</source>
- <p><strong><code>Controller.java</code></strong></p>
+ <source>http://localhost:8080/pageflow_tutorial/begin.do</source>
+ <p>The URL above means this: "Run the <code>begin</code> action of the
+ <code>Controller.java</code> class in the directory <code>pageflow_tutorial</code>."</p>
+ <p><strong><code>Controller.java</code></strong></p>
<source>import javax.servlet.http.HttpSession;
+...
+
import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
@@ -236,7 +243,7 @@
<section id="test_2">
<title>To Test the Page Flow Web Application</title>
<p>Visit the following address:</p>
- <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/Controller.jpf">http://localhost:8080/pageflow_tutorial/Controller.jpf</a></p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
<p>You will be directed to the <code>index.jsp</code> page.</p>
</section>
</section>
@@ -298,6 +305,8 @@
<p><strong><code>Controller.java</code></strong></p>
<source>import javax.servlet.http.HttpSession;
+...
+
import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
@@ -329,7 +338,7 @@
<p>Visit the following link:
</p>
- <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/Controller.jpf">http://localhost:8080/pageflow_tutorial/Controller.jpf</a></p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
<p>You will be directed to the index.jsp page.</p>
<p>Click the link.</p>
<p>You will be directed to page2.jsp.</p>
@@ -356,9 +365,11 @@
</p>
<strong><p>
<netui:form action="processData">
- Name:<netui:textBox dataSource="actionForm.name"/><br/>
- Age:<netui:textBox dataSource="actionForm.age"/><br/>
- <netui:button type="submit">Submit</netui:button>
+ Name: <netui:textBox dataSource="actionForm.name"/>
+ <br/>
+ Age: <netui:textBox dataSource="actionForm.age"/>
+ <br/>
+ <netui:button type="submit" value="Submit"/>
</netui:form>
</p></strong>
</netui:body>
@@ -413,6 +424,8 @@
<p><strong><code>Controller.java</code></strong></p>
<source>import javax.servlet.http.HttpSession;
+...
+
import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
@@ -472,7 +485,7 @@
<title>To Test the Page Flow Web Application</title>
<p>Visit the following link:
</p>
- <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/Controller.jpf">http://localhost:8080/pageflow_tutorial/Controller.jpf</a></p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
<p>You will be directed to the index.jsp page.</p>
<p>Click the link.</p>
<p>You will be directed to page2.jsp.</p>
@@ -502,8 +515,9 @@
You submitted the following information:
</p>
<p>
- Name:<netui:content value="${requestScope.data.name}"/><br/>
- Age:<netui:content value="${requestScope.data.age}"/>
+ Name: <netui:content value="${requestScope.data.name}"/>
+ <br/>
+ Age: <netui:content value="${requestScope.data.age}"/>
</p>
</netui:body>
</netui:html>]]></source>
@@ -519,7 +533,7 @@
@Jpf.Action(
forwards = {
- @Jpf.Forward(name = "success", path = "<strong>displayData.jsp</strong>")
+ @Jpf.Forward(name="success", path="<strong>displayData.jsp</strong>")
}
)
public Forward processData(ProfileForm form)
@@ -544,12 +558,559 @@
<title>To Test the Page Flow Web Application</title>
<p>Visit the following link:
</p>
- <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/Controller.jpf">http://localhost:8080/pageflow_tutorial/Controller.jpf</a></p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
<p>You will be directed to the index.jsp page.</p>
<p>Click the link.</p>
<p>You will be directed to page2.jsp.</p>
<p>Enter values in the Name and Age fields. Click the Submit button.</p>
<p>You will be forwarded to the displayData.jsp page. Notice the values you entered are displayed.</p>
+ </section>
+ </section>
+ <section id="step_6_validate">
+ <title>Step 6: Input Validation</title>
+ <section id="add_validation">
+ <title>To Add Declarative Validation to the Page Flow</title>
+ <p>In this step you will use declarative validation to define the set of rules for each
+ field, to be applied during input validation. Add a <code>ValidatableProperty</code>
+ for the name field of the form so that it will (1) be a required field and
+ (2) have a maximum
+ length of 30 characters. The age field will also be required and must have a value
+ in the range
+ 0 to 130.</p>
+ <p>Open the file <code>C:/beehive_projects/pageflow_tutorial/Controller.java</code></p>
+ <p>Edit the <code>@Jpf.Action</code> annotation for the <code>processData</code> method in the
+ <code>Controller.java</code> file so it appears as follows. Code to add appears in bold.
+ Don't forget the comma after the <code>forwards={...}</code> element!</p>
+ <p><strong><code>Controller.java</code></strong></p>
+ <source>...
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(name="success", path="displayData.jsp")
+ }<strong>,
+ validatableProperties = {
+ @Jpf.ValidatableProperty(
+ propertyName = "name",
+ displayName = "Name",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateMaxLength = @Jpf.ValidateMaxLength(chars = 30)),
+ @Jpf.ValidatableProperty(
+ propertyName = "age",
+ displayName = "Age",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateRange = @Jpf.ValidateRange(minInt = 0, maxInt = 130))
+ },
+ validationErrorForward =
+ @Jpf.Forward(name="fail", navigateTo=Jpf.NavigateTo.currentPage)</strong>
+ )
+ public Forward processData(ProfileForm form)
+ {
+ System.out.println("Name: " + form.getName());
+ System.out.println("Age: " + form.getAge());
+ getRequest().setAttribute("data", form);
+ return new Forward("success");
+ }
+
+ ...</source>
+ <p>Save <code>Controller.java</code>.</p>
+ </section>
+ <section id="display_errors">
+ <title>To Modify the JSP to Display Validation Errors</title>
+ <p>Add the <code><netui:error></code> tag to display validation error messages on the page.</p>
+ <p>Edit the file <code>C:/beehive_projects/pageflow_tutorial/page2.jsp</code> so it appears as follows.</p>
+ <p><strong><code>page2.jsp</code></strong></p>
+ <source><%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+ <head>
+ <title>page2.jsp</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ Welcome to page2.jsp!
+ </p>
+ <p>
+ <netui:form action="processData">
+ Name: <netui:textBox dataSource="actionForm.name"/>
+ <strong><netui:error key="name"/></strong>
+ <br/>
+ Age: <netui:textBox dataSource="actionForm.age"/>
+ <strong><netui:error key="age"/></strong>
+ <br/>
+ <netui:button type="submit" value="Submit"/>
+ </netui:form>
+ </p>
+ </netui:body>
+</netui:html></source>
+ <p>Save and close <code>page2.jsp</code>.</p>
+ </section>
+ <section id="compile_6">
+ <title>To Recompile and Redeploy the Page Flow</title>
+ <p>Compile and deploy the Page Flow using the same Ant and copy commands used in <a href="#compile_2">step 2</a>.</p>
+ <p>If you are asked to overwrite the old WAR file, enter 'Yes'.</p>
+ <p>Wait a few seconds for Tomcat to redeploy the WAR file, then move on to the next step.</p>
+ </section>
+ <section id="test_6">
+ <title>To Test the Page Flow Web Application</title>
+ <p>Visit the following link:</p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
+ <p>You will be directed to the index.jsp page.</p>
+ <p>Click the link.</p>
+ <p>You will be directed to page2.jsp.</p>
+ <p>Leave the Name field empty and enter a negative integer value in the Age field. Click the Submit button.</p>
+ <p>You will be returned to the page2.jsp page. Notice the error messages for the values you entered.</p>
+ </section>
+ </section>
+ <section id="step_7_nested">
+ <title>Step 7: Collect Data from a Nested Page Flow</title>
+ <section id="go_nested">
+ <title>To Link to the Nested Page Flow</title>
+ <p>Modify the HTML form tag to add a new data field and a button and link it to an
+ Action in the nested Page Flow. In a later step, the new nested Controller file
+ will be created to handle the data collection.</p>
+ <p>Edit the file <code>C:/beehive_projects/pageflow_tutorial/page2.jsp</code> so it
+ appears as follows. Code to add appears in bold.</p>
+ <p><strong><code>page2.jsp</code></strong></p>
+ <source><%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+ <head>
+ <title>page2.jsp</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ Welcome to page2.jsp!
+ </p>
+ <p>
+ <netui:form action="processData">
+ Name: <netui:textBox dataSource="actionForm.name"/>
+ <netui:error key="name"/>
+ <br/>
+ Age: <netui:textBox dataSource="actionForm.age"/>
+ <netui:error key="age"/>
+ <br/>
+ <strong>Sport: <netui:textBox dataSource="actionForm.sport"/>
+ <br/>
+ <netui:button type="submit" action="getSport" value="Select Sport"/></strong>
+ <netui:button type="submit" value="Submit"/>
+ </netui:form>
+ </p>
+ </netui:body>
+</netui:html></source>
+ <p>Save <code>page2.jsp</code>.</p>
+ </section>
+ <section id="update_formbean">
+ <title>To Update the Form Bean</title>
+ <p>In this step you will update the Java class that represents the submission form with the
+ additional data field created in the previous task. When the nested Page Flow returns,
+ the new member of the Form Bean class instance can be loaded with the value collected.</p>
+ <p>Edit <code>C:/beehive_projects/pageflow_tutorial/WEB-INF/src/forms/ProfileForm.java</code>
+ and add the following member variable and methods.</p>
+ <p><strong><code>ProfileForm.java</code></strong></p>
+ <source> ...
+
+ private String sport;
+
+ public void setSport(String sport)
+ {
+ this.sport = sport;
+ }
+
+ public String getSport()
+ {
+ return this.sport;
+ }
+
+ ...</source>
+ <p>Save and close <code>ProfileForm.java</code>.</p>
+ </section>
+ <section id="update_controller">
+ <title>To Launch and Return from the Nested Page Flow</title>
+ <p>Add Action methods to handle forwarding to the nested Page Flow and another to
+ implement the return Action when the nested Page Flow completes.</p>
+ <p>Open the file <code>C:/beehive_projects/pageflow_tutorial/Controller.java</code></p>
+ <p>Edit <code>Controller.java</code> so it appears as follows. Code to add appears
+ in bold type. Don't forget to add the <code>useFormBean</code> property to the
+ <code>@Jpf.Action</code> annotation of the <code>processData</code> method. The
+ ProfileForm is Page Flow scoped for this example, using the same Form Bean
+ instance in multiple Action methods.</p>
+ <p><strong><code>Controller.java</code></strong></p>
+ <source>import javax.servlet.http.HttpSession;
+
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import forms.ProfileForm;
+
+@Jpf.Controller(
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp"),
+ @Jpf.SimpleAction(name="toPage2", path="page2.jsp")
+ },
+ sharedFlowRefs={
+ @Jpf.SharedFlowRef(name="shared", type=shared.SharedFlow.class)
+ }
+)
+public class Controller
+ extends PageFlowController
+{
+ <strong>private ProfileForm profileForm;
+
+ /**
+ * This action forwards to the nested Page Flow to collect the sport
+ * name. Note that it takes a ProfileForm so we can update the form
+ * with the sport name returned from the nested Page Flow, but we've
+ * explicitly turned validation off for this action, since the form
+ * may be incomplete.
+ */
+ @Jpf.Action(
+ useFormBean="profileForm",
+ forwards={
+ @Jpf.Forward(name="getSportFlow", path="sports/begin.do")
+ },
+ doValidation=false
+ )
+ protected Forward getSport(ProfileForm form)
+ {
+ return new Forward("getSportFlow");
+ }
+
+ /**
+ * This action takes the sport name returned from the nested Page Flow
+ * and updates the field in the form and returns to the original page.
+ */
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name="success",
+ navigateTo=Jpf.NavigateTo.currentPage
+ )
+ }
+ )
+ protected Forward sportSelected( String sport )
+ {
+ profileForm.setSport( sport );
+ Forward success = new Forward( "success", profileForm );
+ return success;
+ }</strong>
+
+ @Jpf.Action(
+ <strong>useFormBean="profileForm",</strong>
+ forwards = {
+ @Jpf.Forward(name="success", path="displayData.jsp")
+ },
+ validatableProperties = {
+ @Jpf.ValidatableProperty(
+ propertyName = "name",
+ displayName = "Name",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateMaxLength = @Jpf.ValidateMaxLength(chars = 30)),
+ @Jpf.ValidatableProperty(
+ propertyName = "age",
+ displayName = "Age",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateRange = @Jpf.ValidateRange(minInt = 0, maxInt = 130))
+ },
+ validationErrorForward =
+ @Jpf.Forward(name="fail", navigateTo=Jpf.NavigateTo.currentPage)
+ )
+ public Forward processData(ProfileForm form)
+ {
+ System.out.println("Name: " + form.getName());
+ System.out.println("Age: " + form.getAge());
+ getRequest().setAttribute("data", form);
+ return new Forward("success");
+ }
+
+ @Jpf.SharedFlowField(name="shared")
+ private shared.SharedFlow sharedFlow;
+
+ /**
+ * Callback that is invoked when this controller instance is created.
+ */
+ protected void onCreate()
+ {
+ }
+
+ /**
+ * Callback that is invoked when this controller instance is destroyed.
+ */
+ protected void onDestroy(HttpSession session)
+ {
+ }
+}</source>
+ <p>Save <code>Controller.java</code>.</p>
+ </section>
+ <section id="create_nested">
+ <title>To Create a Nested Page Flow</title>
+ <p>In this step you will create a nested Page Flow with actions to select and confirm
+ the data to return to the main or nesting Page Flow. The new nested Controller file
+ contains an inner Form Bean classs for the data collection. It has only a single
+ field for the user's choice of sport activity. The options to be displayed are
+ declared as member data of this nested Page Flow. After the user confirms the
+ data, the nested Page Flow returns a <code>String</code> to the main Page Flow.</p>
+ <p>In the directory <code>C:/beehive_projects/pageflow_tutorial/</code> create a directory
+ named <strong><code>sports</code></strong>.</p>
+ <p>In the directory <code>C:/beehive_projects/pageflow_tutorial/sports</code> create a JAVA
+ file named <strong><code>SportsController.java</code></strong>.</p>
+ <p>Edit <code>C:/beehive_projects/pageflow_tutorial/sports/SportsController.java</code> so it
+ appears as follows.</p>
+
+ <p><strong><code>SportsController.java</code></strong></p>
+ <source>package sports;
+
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+ nested = true,
+ simpleActions = {
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class SportsController
+ extends PageFlowController
+{
+ private String selectedSport;
+ private String[] sports = {"sailing", "surfing", "diving", "volleyball",
+ "bicycling"};
+
+ public String[] getSports() {
+ return sports;
+ }
+
+ public String getSelectedSport() {
+ return selectedSport;
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(name="confirm", path="confirm.jsp")
+ }
+ )
+ public Forward selectSport(SportForm form)
+ {
+ selectedSport = form.getSport();
+ return new Forward("confirm");
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name="success",
+ returnAction="sportSelected",
+ outputFormBeanType=String.class)
+ }
+ )
+ public Forward confirm()
+ {
+ return new Forward("success", selectedSport);
+ }
+
+ public static class SportForm extends FormData
+ {
+ private String sport;
+
+ public void setSport(String sport)
+ {
+ this.sport = sport;
+ }
+
+ public String getSport()
+ {
+ return this.sport;
+ }
+ }
+}</source>
+ <p>Save and close <code>SportsController.java</code>.</p>
+ </section>
+ <section id="collect_data">
+ <title>To Present and Collect Data using a Form</title>
+ <p>This step illustrates the use of custom tags to render a radio button group in an
+ HTML form and link it to the nested Page Flow <code>selectSport</code> Action method.</p>
+ <p>In the directory <code>C:/beehive_projects/pageflow_tutorial/sports</code>, create
+ a file named <code>index.jsp</code>.</p>
+ <p>Edit index.jsp so it appears as follows.</p>
+ <p><strong><code>index.jsp</code></strong></p>
+ <source><![CDATA[<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+ <head>
+ <title>Select Sport</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ Select Sport Activity
+ </p>
+ <p>
+ <netui:form action="selectSport">
+ <table>
+ <tr>
+ <td>Sports:</td>
+ <td>
+ <netui:radioButtonGroup dataSource="actionForm.sport"
+ optionsDataSource="${pageFlow.sports}"/>
+ </td>
+ </tr>
+ <table>
+ <netui:button type="submit">Submit</netui:button>
+ </netui:form>
+ </p>
+ </netui:body>
+</netui:html>]]></source>
+ <p>Save <code>index.jsp</code>.</p>
+ </section>
+ <section id="confirm_data">
+ <title>To Confirm the Selected Data</title>
+ <p>In the directory <code>C:/beehive_projects/pageflow_tutorial/sports</code>, create
+ a file named <code>confirm.jsp</code>.</p>
+ <p>Edit confirm.jsp so it appears as follows.</p>
+ <p><strong><code>confirm.jsp</code></strong></p>
+ <source><![CDATA[<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+ <head>
+ <title>Confirm Sport Activity</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ Confirm Sport Activity
+ </p>
+ <p>
+ Sport: <netui:content value="${pageFlow.selectedSport}"/>
+ </p>
+ <netui:form action="confirm">
+ <netui:button type="submit" value="Confirm"/>
+ </netui:form>
+ </netui:body>
+</netui:html>]]></source>
+ <p>Save <code>confirm.jsp</code>.</p>
+ </section>
+ <section id="compile_7">
+ <title>To Recompile and Redeploy the Page Flow</title>
+ <p>Compile and deploy the Page Flow using the same Ant and copy commands used in <a href="#compile_2">step 2</a>.</p>
+ <p>If you are asked to overwrite the old WAR file, enter 'Yes'.</p>
+ <p>Wait a few seconds for Tomcat to redeploy the WAR file, then move on to the next step.</p>
+ </section>
+ <section id="test_7">
+ <title>To Test the Page Flow Web Application</title>
+ <p>Visit the following link:</p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
+ <p>You will be directed to the index.jsp page.</p>
+ <p>Click the link.</p>
+ <p>You will be directed to page2.jsp.</p>
+ <p>Click the "Select Sport" button.</p>
+ <p>You will be directed to sports/index.jsp in the nested Page Flow.</p>
+ <p>Click a radio button and then the Submit button.</p>
+ <p>You will be directed to sports/confirm.jsp in the nested Page Flow.</p>
+ <p>Click the Confirm button.</p>
+ <p>You will be returned to the page2.jsp page. Notice that the value you selected is
+ displayed in the Sport field.</p>
+ </section>
+ </section>
+ <section id="step_8_sharedflow">
+ <title>Step 8: Adding Actions to a Shared Flow</title>
+ <section id="sharedflow_page">
+ <title>To Create a Common Destination JSP Page</title>
+ <p>In the directory <code>C:/beehive_projects/pageflow_tutorial</code>, create a
+ file named <code>help.jsp</code>.</p>
+ <p>Edit help.jsp so it appears as follows.</p>
+ <p><strong><code>help.jsp</code></strong></p>
+ <source><![CDATA[<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+ <head>
+ <title>Help Page</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ Welcome to the Help Page
+ </p>
+ </netui:body>
+</netui:html>]]></source>
+ <p>Save <code>help.jsp</code>.</p>
+ </section>
+ <section id="sharedflow_action">
+ <title>To Make an Action available to multiple Page Flows</title>
+ <p>In this step you will add a Simple Action to the existing Shared Flow. The Action
+ forwards to the help page created in the previous step and will be available to
+ multiple Page Flows in the application.</p>
+ <p>Open the existing Shared Flow file <code>C:/beehive_projects/pageflow_tutorial/WEB-INF/src/shared/SharedFlow.java</code></p>
+ <p>Edit the <code>@Jpf.Controller</code> annotation for the Shared Flow controller
+ class, <code>SharedFlow</code>, in the <code>SharedFlow.java</code> file and
+ add the <code>simpleActions</code> property. Code to add appears in bold. Don't
+ forget the comma after the <code>catches={...}</code> element!</p>
+ <p><strong><code>SharedFlow.java</code></strong></p>
+ <source>...
+
+@Jpf.Controller(
+ catches={
+ @Jpf.Catch(type=PageFlowException.class, method="handlePageFlowException"),
+ @Jpf.Catch(type=Exception.class, method="handleException")
+ }<strong>,
+ simpleActions={
+ @Jpf.SimpleAction(name="showHelp", path="/help.jsp")
+ }</strong>
+)
+public class SharedFlow
+ extends SharedFlowController
+{
+
+ ...</source>
+ <p>Save <code>SharedFlow.java</code>.</p>
+ </section>
+ <section id="link_sharedflow">
+ <title>To Link a Page to the Shared Flow Action</title>
+ <p>In this step you will create a link from the JSP, <code>index.jsp</code> to the
+ Shared Flow Action.</p>
+ <p>Open the file <code>C:/beehive_projects/pageflow_tutorial/index.jsp</code>.</p>
+ <p>Edit <code>index.jsp</code> so it appears as follows. The code to add appears in bold type.</p>
+ <p><strong><code>index.jsp</code></strong></p>
+ <source><%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<netui:html>
+ <head>
+ <title>Web Application Page</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ New Web Application Page
+ </p>
+ <p>
+ <netui:anchor action="toPage2">Link to page2.jsp</netui:anchor>
+ </p>
+ <strong><netui:anchor action="shared.showHelp" popup="true">Help
+ <netui:configurePopup location="false" width="550" height="150">
+ </netui:configurePopup>
+ </netui:anchor></strong>
+ </netui:body>
+</netui:html>
+ </source>
+ <p>Save <code>index.jsp</code>.</p>
+ </section>
+ <section id="compile_8">
+ <title>To Recompile and Redeploy the Page Flow</title>
+ <p>Compile and deploy the Page Flow using the same Ant and copy commands used in <a href="#compile_2">step 2</a>.</p>
+ <p>If you are asked to overwrite the old WAR file, enter 'Yes'.</p>
+ <p>Wait a few seconds for Tomcat to redeploy the WAR file, then move on to the next step.</p>
+ </section>
+ <section id="test_8">
+ <title>To Test the Page Flow Web Application</title>
+ <p>Visit the following link:</p>
+ <p><a class="fork" href="http://localhost:8080/pageflow_tutorial/begin.do">http://localhost:8080/pageflow_tutorial/begin.do</a></p>
+ <p>You will be directed to the index.jsp page.</p>
+ <p>Click the help link.</p>
+ <p>A popup window with the help.jsp page will be displayed.</p>
</section>
</section>
<!-- <section id="summary">