Author: steveh
Date: Mon Nov 15 11:33:43 2004
New Revision: 71508
Modified:
incubator/beehive/site/build/site/controls/sample_controls-db.html
incubator/beehive/site/build/site/pageflow/pageflow_controllers.html
incubator/beehive/site/build/site/pageflow/tutorial_pageflow.html
incubator/beehive/site/src/documentation/content/xdocs/controls/sample_controls-db.xml
incubator/beehive/site/src/documentation/content/xdocs/pageflow/pageflow_controllers.xml
incubator/beehive/site/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml
Log:
Fixes for
BEEHIVE-81: Page Flow Overview - clarification on form bean classes
BEEHIVE-47: Page Flow compile command shell output Needs to be updated
Misc edits included:
-Added bold text to pageflow tut.
-Modified pageflow tut. so that it uses a stand-alone form bean, not an inner
class. The class is no longer a subclass of FormData.
Modified: incubator/beehive/site/build/site/controls/sample_controls-db.html
==============================================================================
--- incubator/beehive/site/build/site/controls/sample_controls-db.html
(original)
+++ incubator/beehive/site/build/site/controls/sample_controls-db.html Mon Nov
15 11:33:43 2004
@@ -291,6 +291,9 @@
<a href="#Control+Programming%3A+Simplifying+Access+to+Resources">Control
Programming: Simplifying Access to Resources</a>
</li>
<li>
+<a href="#The+EmployeeWS+Sample">The EmployeeWS Sample</a>
+</li>
+<li>
<a href="#Building+the+Database+Control">Building the Database Control</a>
</li>
</ul>
@@ -346,17 +349,52 @@
{
String jndiName(); // no default ... value is required
}</pre>
-<p>The Database control is current included in the Beehive distribution as a
sample control (\samples\controls-db). Building this control with the Ant
script provided will create a <span class="codefrag">dbControl.jar</span> in
\samples\controls-db\build\. You can start creating your own database control
extension by simply including this JAR file in your classpath.</p>
+</div>
+
+<p>The Database control is currently included in the Beehive distribution as a
sample control (\samples\controls-db). Building this control with the Ant
script provided will create a <span class="codefrag">dbControl.jar</span> in
\samples\controls-db\build\. You can start creating your own database control
extension by simply including this JAR file in your classpath.</p>
+
+
+<a name="N10070"></a><a name="The+EmployeeWS+Sample"></a>
+<h3>The EmployeeWS Sample</h3>
+<div style="margin-left: 0 ; border: 2px">
<p>Notice that the sample <a
href="../wsm/sample_AddressBook.html">EmployeeWS</a> uses this same technique
(subclassing DatabaseControl) for database access. The EmployeeWS sample is a
database control exposed as a web service. The exposed database control,
EmployeeDBControl, is a subclass of DatabaseControl (archived in <span
class="codefrag">dbControl.jar</span>).</p>
<pre class="code">public interface EmployeeDBControl extends DatabaseControl
{
...
}
</pre>
+<p>The Java source for EmployeeDBControl is available at <span
class="codefrag">BEEHIVE_HOME/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBControl.jcx</span>.</p>
</div>
+
+<!-- </p>
+ <section>
+ <title>Structure of the Database Control</title>
+ </section>
+ <p>The Database Control is a <em>base control</em>: it is designed to
be extented by a <em>control extension</em>. Base controls package the
boilerplate code, the common routines that any code must execute in order to
access a resource. Control extensions contain the interesting, variable
aspects of accessing the resource. If this model were applied to the case of
JMS access, the base control would contain the boilerplate tasks consisting of
obtaining sessions, referencing queues, etc. The control extension configures
the base control for access to a particular JMS resource. The control
extension would anwser the questions: What the JNDI name of the JMS resources?
What message should be sent?
+</p><p>
+In the case of a database resource, The boilerplate parts of the code are
tasks such as making a JDBC connection with the database and handling the
resultsets, tasks specified in the base control. An extension of the base
database control configures the base control by setting the JNDI name the
target database, the SQL statements used to communicate with the database, the
maximum size of resultsets that the control will accept, etc.
+</p><p>
+Not all base controls need to extended to be used: they can be designed to be
used directly by the client, without an control extension intermediary. But in
the case of the database Database Control is designed in order to be extended
by another class, which answers all of the parameter questions: the interesting
parts of accessing the particular resource, whatever it is. An example of a
control extention off of the base Database Control is EmployeeDBControl.jcx
(located at
BEEHIVE_HOME/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample). The
fragment below shows how the control extension configures the base control for
a JDBC connection to a particular Derby database.
+ </p>
+<p><strong>EmployeeDBControl.jcx</strong></p>
+<source>@ControlExtension
[EMAIL PROTECTED](jndiName="jdbc:derby:build/databaseControlTestDB;create=true")
+public interface EmployeeDBControl extends DatabaseControl
+{
+ ...
+}
+</source>
+
+ <ul>
+ <li>Metadata annotations: reduces configuring the control for resource
access to a matter of setting properties throught annotations. To a client,
the control appears as a JavaBean that is instantiated and operated upon for
resource access. Base controls configure the container using annotations.
Control extensions configure the base.</li>
+-->
+<!-- <li>events (<link
href="http://incubator.apache.org/beehive/ControlsOverview.html#Operations">http://incubator.apache.org/beehive/ControlsOverview.html#Operations</link>)</li>
+ <li>resource management (<link
href="http://incubator.apache.org/beehive/ControlsOverview.html#Resource%20Management">http://incubator.apache.org/beehive/ControlsOverview.html#Resource%20Management</link>)....
[todo]</li>
+ </ul>-->
+
-<a name="N10083"></a><a name="Building+the+Database+Control"></a>
+<a name="N10090"></a><a name="Building+the+Database+Control"></a>
<h3>Building the Database Control</h3>
<div style="margin-left: 0 ; border: 2px">
<p>To build <span class="codefrag">dbControl.jar</span> run the following Ant
command:</p>
Modified: incubator/beehive/site/build/site/pageflow/pageflow_controllers.html
==============================================================================
--- incubator/beehive/site/build/site/pageflow/pageflow_controllers.html
(original)
+++ incubator/beehive/site/build/site/pageflow/pageflow_controllers.html
Mon Nov 15 11:33:43 2004
@@ -621,8 +621,9 @@
<div style="margin-left: 0 ; border: 2px">
<p>
Handling form data works similar to other controller methods. By
providing a parameter
- to the controller method, a populated subclass of <span
class="codefrag">org.apache.beehive.netui.pageflow.FormData</span>, the form
data is made available to the controller method. In the above model,
controller methods that process forms have been named
+ to the controller method the HTML form data is made available to the
controller method. In the above model, controller methods that process forms
have been named
with the <span class="codefrag">processXXX(..)</span> convention.
+ <!--, a populated subclass of
<code>org.apache.beehive.netui.pageflow.FormData</code>, -->
</p>
<ul>
@@ -636,8 +637,9 @@
</ul>
<p>
- First, define a subclass of <span class="codefrag">FormData</span>. It
may be defined (1) as a <span class="codefrag">static</span>
- inner class of the controller itself (see example below) or (2) as a
stand-alone Java class in a separate file. <span
class="codefrag">FormData</span> classes follow normal JavaBean conventions and
require no special annotations.
+ First, define a JavaBean to represent the HTML form to be submitted.
This JavaBean can be of any Java type. (In Struts applications the JavaBean
must be a subclass of <span
class="codefrag">org.apache.struts.action.ActionForm</span>. Similarly, in
earlier incarnations of Page Flows the JavaBean had to be a subclass of <span
class="codefrag">org.apache.beehive.netui.pageflow.FormData</span>. But this
restriction has been loosened in the current incarnation: the JavaBean
representation may be any JavaBean type.)
+ </p>
+<p>The JavaBean may be defined (1) as a <span class="codefrag">static</span>
inner class of the controller itself (see example below) or (2) as a
stand-alone Java class in a separate file. The JavaBean class follows normal
JavaBean conventions and require no special annotations. The JavaBean shown
below is a subclass of <span class="codefrag">FormData</span>, but this is not
a requirement. The JavaBean can be of any type.
</p>
<pre class="code">
import org.apache.beehive.netui.pageflow.Forward;
@@ -774,7 +776,7 @@
</div>
-<a name="N101BB"></a><a name="next"></a>
+<a name="N101C0"></a><a name="next"></a>
<h3>Next...</h3>
<div style="margin-left: 0 ; border: 2px">
<p>
Modified: incubator/beehive/site/build/site/pageflow/tutorial_pageflow.html
==============================================================================
--- incubator/beehive/site/build/site/pageflow/tutorial_pageflow.html
(original)
+++ incubator/beehive/site/build/site/pageflow/tutorial_pageflow.html Mon Nov
15 11:33:43 2004
@@ -369,7 +369,7 @@
<a href="#To+Compile+and+Redeploy+the+Page+Flow">To Compile and Redeploy the
Page Flow</a>
</li>
<li>
-<a href="#To+Test+the+Page+Flow+Web+Application-N10251">To Test the Page Flow
Web Application</a>
+<a href="#To+Test+the+Page+Flow+Web+Application-N10257">To Test the Page Flow
Web Application</a>
</li>
</ul>
</li>
@@ -380,13 +380,16 @@
<a href="#To+Create+a+Submission+Form">To Create a Submission Form</a>
</li>
<li>
+<a href="#To+Create+a+Server+Side+Representation+of+the+Submission+Form">To
Create a Server Side Representation of the Submission Form</a>
+</li>
+<li>
<a href="#To+Edit+the+Controller+File+to+Handle+the+Submitted+Data">To Edit
the Controller File to Handle the Submitted Data</a>
</li>
<li>
-<a href="#To+Compile+and+Redeploy+the+Page+Flow-N102A6">To Compile and
Redeploy the Page Flow</a>
+<a href="#To+Compile+and+Redeploy+the+Page+Flow-N102E1">To Compile and
Redeploy the Page Flow</a>
</li>
<li>
-<a href="#To+Test+the+Page+Flow+Web+Application-N102B4">To Test the Page Flow
Web Application</a>
+<a href="#To+Test+the+Page+Flow+Web+Application-N102EF">To Test the Page Flow
Web Application</a>
</li>
</ul>
</li>
@@ -394,22 +397,19 @@
<a href="#step_5">Step 5: Processing and Displaying Data</a>
<ul class="minitoc">
<li>
-<a href="#To+Process+the+Submitted+Data">To Process the Submitted Data</a>
+<a href="#To+Create+a+JSP+Page+to+Display+Submitted+Data">To Create a JSP Page
to Display Submitted Data</a>
</li>
<li>
-<a href="#To+Create+a+JSP+Page+to+Display+Submitted+Data">To Create a JSP Page
to Display Submitted Data</a>
+<a href="#To+Process+the+Submitted+Data">To Process the Submitted Data</a>
</li>
<li>
-<a href="#To+Compile+and+Redeploy+the+Page+Flow-N102FB">To Compile and
Redeploy the Page Flow</a>
+<a href="#To+Compile+and+Redeploy+the+Page+Flow-N1033C">To Compile and
Redeploy the Page Flow</a>
</li>
<li>
-<a href="#To+Test+the+Page+Flow+Web+Application-N10309">To Test the Page Flow
Web Application</a>
+<a href="#To+Test+the+Page+Flow+Web+Application-N1034A">To Test the Page Flow
Web Application</a>
</li>
</ul>
</li>
-<li>
-<a href="#summary">Summary: Page Flow Tutorial</a>
-</li>
</ul>
<a name="N1000C"></a><a name="intro"></a>
@@ -660,7 +660,7 @@
<div style="margin-left: 0 ; border: 2px">
<p>Visit the following address:</p>
<p>
-<a
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
+<a target="_blank"
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
</p>
<p>You will be directed to the <span class="codefrag">index.jsp</span>
page.</p>
</div>
@@ -693,7 +693,7 @@
<h4>To Create a Link to the Destination Page</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Open the file <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/index.jsp</span>.</p>
-<p>Edit <span class="codefrag">index.jsp</span> so it appears as follows.</p>
+<p>Edit <span class="codefrag">index.jsp</span> so it appears as follows.
Code to add appears in bold type.</p>
<pre class="code">
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0"
prefix="netui"%>
@@ -706,14 +706,14 @@
<p>
index.jsp
</p>
- <p>
+ <strong><p>
<netui:anchor action="toPage2">Link to
page2.jsp</netui:anchor>
- </p>
+ </p></strong>
</netui:body>
</netui:html>
</pre>
</div>
-<a name="N1023B"></a><a name="To+Add+an+Action+Method+to+Handle+the+Link"></a>
+<a name="N1023E"></a><a name="To+Add+an+Action+Method+to+Handle+the+Link"></a>
<h4>To Add an Action Method to Handle the Link</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Open the file <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/Controller.jpf</span>.</p>
@@ -723,8 +723,7 @@
import org.apache.beehive.netui.pageflow.annotations.Jpf;
@Jpf.Controller
-public class Controller
- extends PageFlowController
+public class Controller extends PageFlowController
{
@Jpf.Action(
forwards={
@@ -736,7 +735,7 @@
return new Forward("success");
}
- @Jpf.Action(
+ <strong>@Jpf.Action(
forwards={
@Jpf.Forward(name="success", path="page2.jsp")
}
@@ -744,10 +743,10 @@
public Forward toPage2()
{
return new Forward("success");
- }
+ }</strong>
}</pre>
</div>
-<a name="N10253"></a><a name="To+Compile+and+Redeploy+the+Page+Flow"></a>
+<a name="N10259"></a><a name="To+Compile+and+Redeploy+the+Page+Flow"></a>
<h4>To Compile and Redeploy the Page Flow</h4>
<div style="margin-left: 0 ; border: 2px">
<p>At the command prompt, enter:</p>
@@ -757,16 +756,15 @@
-Dcontext.path=pageflow_tutorial
undeploy
build.webapp
- deploy
- </pre>
+ deploy</pre>
</div>
-<a name="N10262"></a><a
name="To+Test+the+Page+Flow+Web+Application-N10251"></a>
+<a name="N10268"></a><a
name="To+Test+the+Page+Flow+Web+Application-N10257"></a>
<h4>To Test the Page Flow Web Application</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Visit the following link:
</p>
<p>
-<a
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
+<a target="_blank"
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
</p>
<p>You will be directed to the index.jsp page.</p>
<p>Click the link.</p>
@@ -774,10 +772,10 @@
</div>
</div>
-<a name="N1027B"></a><a name="step_4"></a>
+<a name="N10281"></a><a name="step_4"></a>
<h3>Step 4: Submitting Data</h3>
<div style="margin-left: 0 ; border: 2px">
-<a name="N10281"></a><a name="To+Create+a+Submission+Form"></a>
+<a name="N10287"></a><a name="To+Create+a+Submission+Form"></a>
<h4>To Create a Submission Form</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Edit the file <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/page2.jsp</span> so it
appears as follows.</p>
@@ -792,29 +790,64 @@
<p>
Welcome to page2.jsp!
</p>
- <p>
+ <strong><p>
<netui:form action="processData">
<p>Name:<netui:textBox dataSource="actionForm.name"/>
<p>Age:<netui:textBox dataSource="actionForm.age"/>
- <p><netui:button type="submit">Submit</netui:button>
+ <p><netui:button type="submit">Submit</netui:button>
</netui:form>
- </p>
+ </p></strong>
</netui:body>
</netui:html></pre>
<p>Save and close <span class="codefrag">page2.jsp</span>.</p>
</div>
-<a name="N10299"></a><a
name="To+Edit+the+Controller+File+to+Handle+the+Submitted+Data"></a>
+<a name="N102A2"></a><a
name="To+Create+a+Server+Side+Representation+of+the+Submission+Form"></a>
+<h4>To Create a Server Side Representation of the Submission Form</h4>
+<div style="margin-left: 0 ; border: 2px">
+<p>In this step you will create a Java class that represents the submission
form created in the previous task. When the form data is submitted, the Java
class will be instantiated, and the form data will be loaded into the members
of the Java class.</p>
+<p>In the directory <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/WEB-INF/src</span>
create a directory named <span class="codefrag">forms</span>.</p>
+<p>In the directory <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/WEB-INF/src/forms</span>
create a JAVA file named <span class="codefrag">ProfileForm.java</span>.</p>
+<p>Edit <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/WEB-INF/src/forms/ProfileForm.java</span>
so it appears as follows.</p>
+<pre class="code">package forms;
+
+public class ProfileForm
+{
+ private int age;
+ private String name;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ public int getAge()
+ {
+ return this.age;
+ }
+}</pre>
+<p>Save and close <span class="codefrag">ProfileForm.java</span>.</p>
+</div>
+<a name="N102CF"></a><a
name="To+Edit+the+Controller+File+to+Handle+the+Submitted+Data"></a>
<h4>To Edit the Controller File to Handle the Submitted Data</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Open the file <span
class="codefrag">C:/beehive_projects/pageflow_tutorial/Controller.jpf</span>
</p>
-<p>Edit <span class="codefrag">Controller.jpf</span> so it appears as
follows.</p>
-<pre class="code">
-import org.apache.beehive.netui.pageflow.Forward;
+<p>Edit <span class="codefrag">Controller.jpf</span> so it appears as follows.
Code to add appears in bold type.</p>
+<pre class="code">import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
-import org.apache.beehive.netui.pageflow.FormData;
+<strong>import forms.ProfileForm;</strong>
@Jpf.Controller
public class Controller extends PageFlowController
@@ -839,48 +872,21 @@
return new Forward("success");
}
- @Jpf.Action(
+ <strong>@Jpf.Action(
forwards = {
@Jpf.Forward(name = "success", path = "page2.jsp")
}
)
- public Forward processData(ProcessDataForm form)
+ public Forward processData(ProfileForm form)
{
- System.out.println("Name: " + form.name);
- System.out.println("Age: " + form.age);
+ System.out.println("Name: " + form.getName());
+ System.out.println("Age: " + form.getAge());
return new Forward("success");
- }
-
- public static class ProcessDataForm extends FormData
- {
- private int age;
- private String name;
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public void setAge(int age)
- {
- this.age = age;
- }
-
- public int getAge()
- {
- return this.age;
- }
- }
-}
- </pre>
+ }</strong>
+}</pre>
<p>Save and close <span class="codefrag">Controller.jpf</span>.</p>
</div>
-<a name="N102B9"></a><a
name="To+Compile+and+Redeploy+the+Page+Flow-N102A6"></a>
+<a name="N102F5"></a><a
name="To+Compile+and+Redeploy+the+Page+Flow-N102E1"></a>
<h4>To Compile and Redeploy the Page Flow</h4>
<div style="margin-left: 0 ; border: 2px">
<p>At the command prompt, enter:</p>
@@ -890,16 +896,15 @@
-Dcontext.path=pageflow_tutorial
undeploy
build.webapp
- deploy
- </pre>
+ deploy</pre>
</div>
-<a name="N102C8"></a><a
name="To+Test+the+Page+Flow+Web+Application-N102B4"></a>
+<a name="N10304"></a><a
name="To+Test+the+Page+Flow+Web+Application-N102EF"></a>
<h4>To Test the Page Flow Web Application</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Visit the following link:
</p>
<p>
-<a
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
+<a target="_blank"
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
</p>
<p>You will be directed to the index.jsp page.</p>
<p>Click the link.</p>
@@ -909,30 +914,13 @@
</div>
</div>
-<a name="N102E7"></a><a name="step_5"></a>
+<a name="N10323"></a><a name="step_5"></a>
<h3>Step 5: Processing and Displaying Data</h3>
<div style="margin-left: 0 ; border: 2px">
-<a name="N102ED"></a><a name="To+Process+the+Submitted+Data"></a>
-<h4>To Process the Submitted Data</h4>
-<div style="margin-left: 0 ; border: 2px">
-<p>Edit the processData method in the Controller.jpf file so it appears as
follows. Code to add appears in red.</p>
-<pre class="code">@Jpf.Action(
- forwards = {
- @Jpf.Forward( name = "success", path = "displayData.jsp" )
- }
-)
-public Forward processData( ProcessDataForm form )
-{
- System.out.println("Name: " + form.name);
- System.out.println("Age: " + form.age);
- getRequest().setAttribute("data", form);
- return new Forward("success");
-}</pre>
-</div>
-<a name="N102FC"></a><a
name="To+Create+a+JSP+Page+to+Display+Submitted+Data"></a>
+<a name="N10329"></a><a
name="To+Create+a+JSP+Page+to+Display+Submitted+Data"></a>
<h4>To Create a JSP Page to Display Submitted Data</h4>
<div style="margin-left: 0 ; border: 2px">
-<p>Create a file named <span class="codefrag">displayData.jsp</span> in the
directory CATALINA_HOME/pageflow_tutorial. Edit <span
class="codefrag">displayData.jsp</span> so it appears as follows.</p>
+<p>In the directory <span class="codefrag">C:/pageflow_tutorial</span> Create
a file named <span class="codefrag">displayData.jsp</span>. Edit <span
class="codefrag">displayData.jsp</span> so it appears as follows.</p>
<pre class="code"><%@ page language="java"
contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0"
prefix="netui"%>
<netui:html>
@@ -946,7 +934,24 @@
</netui:body>
</netui:html></pre>
</div>
-<a name="N10311"></a><a
name="To+Compile+and+Redeploy+the+Page+Flow-N102FB"></a>
+<a name="N10341"></a><a name="To+Process+the+Submitted+Data"></a>
+<h4>To Process the Submitted Data</h4>
+<div style="margin-left: 0 ; border: 2px">
+<p>Edit the processData method in the Controller.jpf file so it appears as
follows. Code to add appears in bold.</p>
+<pre class="code"> @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(name = "success", path = "displayData.jsp")
+ }
+ )
+ public Forward processData(ProfileForm form)
+ {
+ System.out.println("Name: " + form.getName());
+ System.out.println("Age: " + form.getAge());
+ <strong>getRequest().setAttribute("data", form);</strong>
+ return new Forward("success");
+ }</pre>
+</div>
+<a name="N10353"></a><a
name="To+Compile+and+Redeploy+the+Page+Flow-N1033C"></a>
<h4>To Compile and Redeploy the Page Flow</h4>
<div style="margin-left: 0 ; border: 2px">
<p>At the command prompt, enter:</p>
@@ -956,16 +961,15 @@
-Dcontext.path=pageflow_tutorial
undeploy
build.webapp
- deploy
- </pre>
+ deploy</pre>
</div>
-<a name="N10320"></a><a
name="To+Test+the+Page+Flow+Web+Application-N10309"></a>
+<a name="N10362"></a><a
name="To+Test+the+Page+Flow+Web+Application-N1034A"></a>
<h4>To Test the Page Flow Web Application</h4>
<div style="margin-left: 0 ; border: 2px">
<p>Visit the following link:
</p>
<p>
-<a
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
+<a target="_blank"
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</a>
</p>
<p>You will be directed to the index.jsp page.</p>
<p>Click the link.</p>
@@ -974,16 +978,14 @@
<p>You will be forwarded to the displayData.jsp page. Notice the values you
entered are displayed.</p>
</div>
</div>
-
-<a name="N1033F"></a><a name="summary"></a>
-<h3>Summary: Page Flow Tutorial</h3>
-<div style="margin-left: 0 ; border: 2px">
-<p>This tutorial introduced you to the basics of building web applications
with Beehive Page Flows.</p>
-<p>Concepts and Tasks Introduced in This Tutorial</p>
-<p>
+<!-- <section id="summary">
+ <title>Summary: Page Flow Tutorial</title>
+ <p>This tutorial introduced you to the basics of building web
applications with Beehive Page Flows.</p>
+ <p>Concepts and Tasks Introduced in This Tutorial</p>
+ <p>
[TODO: complete summary]
</p>
-</div>
+ </section>-->
<div class="attribution"></div>
</div>
Modified:
incubator/beehive/site/src/documentation/content/xdocs/controls/sample_controls-db.xml
==============================================================================
---
incubator/beehive/site/src/documentation/content/xdocs/controls/sample_controls-db.xml
(original)
+++
incubator/beehive/site/src/documentation/content/xdocs/controls/sample_controls-db.xml
Mon Nov 15 11:33:43 2004
@@ -79,16 +79,19 @@
{
String jndiName(); // no default ... value is required
}</source>
-
-<p>The Database control is current included in the Beehive distribution as a
sample control (\samples\controls-db). Building this control with the Ant
script provided will create a <code>dbControl.jar</code> in
\samples\controls-db\build\. You can start creating your own database control
extension by simply including this JAR file in your classpath.</p>
+</section>
+<p>The Database control is currently included in the Beehive distribution as a
sample control (\samples\controls-db). Building this control with the Ant
script provided will create a <code>dbControl.jar</code> in
\samples\controls-db\build\. You can start creating your own database control
extension by simply including this JAR file in your classpath.</p>
+<section>
+ <title>The EmployeeWS Sample</title>
<p>Notice that the sample <link
href="../wsm/sample_AddressBook.html">EmployeeWS</link> uses this same
technique (subclassing DatabaseControl) for database access. The EmployeeWS
sample is a database control exposed as a web service. The exposed database
control, EmployeeDBControl, is a subclass of DatabaseControl (archived in
<code>dbControl.jar</code>).</p>
<source>public interface EmployeeDBControl extends DatabaseControl
{
...
}
</source>
-
+<p>The Java source for EmployeeDBControl is available at
<code>BEEHIVE_HOME/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBControl.jcx</code>.</p>
+</section>
<!-- </p>
<section>
@@ -116,7 +119,6 @@
<li>resource management (<link
href="http://incubator.apache.org/beehive/ControlsOverview.html#Resource%20Management">http://incubator.apache.org/beehive/ControlsOverview.html#Resource%20Management</link>)....
[todo]</li>
</ul>-->
- </section>
<section>
<title>Building the Database Control</title>
Modified:
incubator/beehive/site/src/documentation/content/xdocs/pageflow/pageflow_controllers.xml
==============================================================================
---
incubator/beehive/site/src/documentation/content/xdocs/pageflow/pageflow_controllers.xml
(original)
+++
incubator/beehive/site/src/documentation/content/xdocs/pageflow/pageflow_controllers.xml
Mon Nov 15 11:33:43 2004
@@ -324,8 +324,9 @@
<p>
Handling form data works similar to other controller methods. By
providing a parameter
- to the controller method, a populated subclass of
<code>org.apache.beehive.netui.pageflow.FormData</code>, the form data is made
available to the controller method. In the above model, controller methods
that process forms have been named
+ to the controller method the HTML form data is made available to the
controller method. In the above model, controller methods that process forms
have been named
with the <code>processXXX(..)</code> convention.
+ <!--, a populated subclass of
<code>org.apache.beehive.netui.pageflow.FormData</code>, -->
</p>
<ul>
@@ -334,8 +335,9 @@
</ul>
<p>
- First, define a subclass of <code>FormData</code>. It may be defined
(1) as a <code>static</code>
- inner class of the controller itself (see example below) or (2) as a
stand-alone Java class in a separate file. <code>FormData</code> classes
follow normal JavaBean conventions and require no special annotations.
+ First, define a JavaBean to represent the HTML form to be submitted.
This JavaBean can be of any Java type. (In Struts applications the JavaBean
must be a subclass of <code>org.apache.struts.action.ActionForm</code>.
Similarly, in earlier incarnations of Page Flows the JavaBean had to be a
subclass of <code>org.apache.beehive.netui.pageflow.FormData</code>. But this
restriction has been loosened in the current incarnation: the JavaBean
representation may be any JavaBean type.)
+ </p>
+ <p>The JavaBean may be defined (1) as a <code>static</code> inner class of
the controller itself (see example below) or (2) as a stand-alone Java class in
a separate file. The JavaBean class follows normal JavaBean conventions and
require no special annotations. The JavaBean shown below is a subclass of
<code>FormData</code>, but this is not a requirement. The JavaBean can be of
any type.
</p>
<source>
Modified:
incubator/beehive/site/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml
==============================================================================
---
incubator/beehive/site/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml
(original)
+++
incubator/beehive/site/src/documentation/content/xdocs/pageflow/tutorial_pageflow.xml
Mon Nov 15 11:33:43 2004
@@ -222,7 +222,7 @@
<section>
<title>To Test the Page Flow Web Application</title>
<p>Visit the following address:</p>
- <p><link
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</link></p>
+ <p><fork
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</fork></p>
<p>You will be directed to the <code>index.jsp</code> page.</p>
</section>
</section>
@@ -250,37 +250,36 @@
<section>
<title>To Create a Link to the Destination Page</title>
<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.</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>index.jsp</title>
- <netui:base/>
- </head>
- <netui:body>
- <p>
+ <p>Edit <code>index.jsp</code> so it appears as follows. Code
to add appears in bold type.</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>index.jsp</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
index.jsp
- </p>
- <p>
- <netui:anchor action="toPage2">Link to page2.jsp</netui:anchor>
- </p>
- </netui:body>
-</netui:html>
- ]]></source>
+ </p>
+ <strong><p>
+ <netui:anchor action="toPage2">Link to page2.jsp</netui:anchor>
+ </p></strong>
+ </netui:body>
+</netui:html>
+ </source>
</section>
<section>
<title>To Add an Action Method to Handle the Link</title>
<p>Open the file
<code>C:/beehive_projects/pageflow_tutorial/Controller.jpf</code>.</p>
<p>Edit <code>Controller.jpf</code> so it appears as
follows.</p>
- <source><![CDATA[import
org.apache.beehive.netui.pageflow.PageFlowController;
+ <source>import
org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
@Jpf.Controller
-public class Controller
- extends PageFlowController
+public class Controller extends PageFlowController
{
@Jpf.Action(
forwards={
@@ -292,7 +291,7 @@
return new Forward("success");
}
- @Jpf.Action(
+ <strong>@Jpf.Action(
forwards={
@Jpf.Forward(name="success", path="page2.jsp")
}
@@ -300,8 +299,8 @@
public Forward toPage2()
{
return new Forward("success");
- }
-}]]></source>
+ }</strong>
+}</source>
</section>
<section>
<title>To Compile and Redeploy the Page Flow</title>
@@ -312,14 +311,13 @@
-Dcontext.path=pageflow_tutorial
undeploy
build.webapp
- deploy
- </source>
+ deploy</source>
</section>
<section>
<title>To Test the Page Flow Web Application</title>
<p>Visit the following link:
</p>
- <p><link
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</link></p>
+ <p><fork
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</fork></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>
@@ -330,38 +328,73 @@
<section>
<title>To Create a Submission Form</title>
<p>Edit the file
<code>C:/beehive_projects/pageflow_tutorial/page2.jsp</code> so it appears as
follows.</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>page2.jsp</title>
- <netui:base/>
- </head>
- <netui:body>
- <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">
- <p>Name:<netui:textBox dataSource="actionForm.name"/>
- <p>Age:<netui:textBox dataSource="actionForm.age"/>
- <p><netui:button type="submit">Submit</netui:button>
- </netui:form>
- </p>
- </netui:body>
-</netui:html>]]></source>
+ </p>
+ <strong><p>
+ <netui:form action="processData">
+ <p>Name:<netui:textBox dataSource="actionForm.name"/>
+ <p>Age:<netui:textBox dataSource="actionForm.age"/>
+ <p><netui:button type="submit">Submit</netui:button>
+ </netui:form>
+ </p></strong>
+ </netui:body>
+</netui:html></source>
<p>Save and close <code>page2.jsp</code>.</p>
</section>
+
+ <section>
+ <title>To Create a Server Side Representation of the
Submission Form</title>
+ <p>In this step you will create a Java class that represents
the submission form created in the previous task. When the form data is
submitted, the Java class will be instantiated, and the form data will be
loaded into the members of the Java class.</p>
+ <p>In the directory
<code>C:/beehive_projects/pageflow_tutorial/WEB-INF/src</code> create a
directory named <code>forms</code>.</p>
+ <p>In the directory
<code>C:/beehive_projects/pageflow_tutorial/WEB-INF/src/forms</code> create a
JAVA file named <code>ProfileForm.java</code>.</p>
+ <p>Edit
<code>C:/beehive_projects/pageflow_tutorial/WEB-INF/src/forms/ProfileForm.java</code>
so it appears as follows.</p>
+ <source>package forms;
+
+public class ProfileForm
+{
+ private int age;
+ private String name;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ public int getAge()
+ {
+ return this.age;
+ }
+}</source>
+<p>Save and close <code>ProfileForm.java</code>.</p>
+ </section>
<section>
<title>To Edit the Controller File to Handle the Submitted
Data</title>
<p>Open the file
<code>C:/beehive_projects/pageflow_tutorial/Controller.jpf</code>
</p>
- <p>Edit <code>Controller.jpf</code> so it appears as
follows.</p>
- <source><![CDATA[
-import org.apache.beehive.netui.pageflow.Forward;
+ <p>Edit <code>Controller.jpf</code> so it appears as follows.
Code to add appears in bold type.</p>
+ <source>import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
-import org.apache.beehive.netui.pageflow.FormData;
+<strong>import forms.ProfileForm;</strong>
@Jpf.Controller
public class Controller extends PageFlowController
@@ -386,45 +419,18 @@
return new Forward("success");
}
- @Jpf.Action(
+ <strong>@Jpf.Action(
forwards = {
@Jpf.Forward(name = "success", path = "page2.jsp")
}
)
- public Forward processData(ProcessDataForm form)
+ public Forward processData(ProfileForm form)
{
- System.out.println("Name: " + form.name);
- System.out.println("Age: " + form.age);
+ System.out.println("Name: " + form.getName());
+ System.out.println("Age: " + form.getAge());
return new Forward("success");
- }
-
- public static class ProcessDataForm extends FormData
- {
- private int age;
- private String name;
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public void setAge(int age)
- {
- this.age = age;
- }
-
- public int getAge()
- {
- return this.age;
- }
- }
-}
- ]]></source>
+ }</strong>
+}</source>
<!--<p>[TODO: what is this code doing?]</p>-->
<p>Save and close <code>Controller.jpf</code>.</p>
</section>
@@ -437,14 +443,13 @@
-Dcontext.path=pageflow_tutorial
undeploy
build.webapp
- deploy
- </source>
+ deploy</source>
</section>
<section>
<title>To Test the Page Flow Web Application</title>
<p>Visit the following link:
</p>
- <p><link
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</link></p>
+ <p><fork
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</fork></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>
@@ -455,24 +460,8 @@
<section id="step_5">
<title>Step 5: Processing and Displaying Data</title>
<section>
- <title>To Process the Submitted Data</title>
- <p>Edit the processData method in the Controller.jpf file so
it appears as follows. Code to add appears in red.</p>
- <source><[EMAIL PROTECTED](
- forwards = {
- @Jpf.Forward( name = "success", path = "displayData.jsp" )
- }
-)
-public Forward processData( ProcessDataForm form )
-{
- System.out.println("Name: " + form.name);
- System.out.println("Age: " + form.age);
- getRequest().setAttribute("data", form);
- return new Forward("success");
-}]]></source>
- </section>
- <section>
<title>To Create a JSP Page to Display Submitted Data</title>
- <p>Create a file named <code>displayData.jsp</code> in the
directory CATALINA_HOME/pageflow_tutorial. Edit <code>displayData.jsp</code> so
it appears as follows.</p>
+ <p>In the directory <code>C:/pageflow_tutorial</code> Create a
file named <code>displayData.jsp</code>. Edit <code>displayData.jsp</code> so
it appears as follows.</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>
@@ -485,6 +474,22 @@
<p>Age:<netui:span value="${requestScope.data.age}"/>
</netui:body>
</netui:html>]]></source>
+ </section>
+ <section>
+ <title>To Process the Submitted Data</title>
+ <p>Edit the processData method in the Controller.jpf file so
it appears as follows. Code to add appears in bold.</p>
+ <source> @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(name = "success", path = "displayData.jsp")
+ }
+ )
+ public Forward processData(ProfileForm form)
+ {
+ System.out.println("Name: " + form.getName());
+ System.out.println("Age: " + form.getAge());
+ <strong>getRequest().setAttribute("data", form);</strong>
+ return new Forward("success");
+ }</source>
</section>
<section>
<title>To Compile and Redeploy the Page Flow</title>
@@ -495,14 +500,13 @@
-Dcontext.path=pageflow_tutorial
undeploy
build.webapp
- deploy
- </source>
+ deploy</source>
</section>
<section>
<title>To Test the Page Flow Web Application</title>
<p>Visit the following link:
</p>
- <p><link
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</link></p>
+ <p><fork
href="http://localhost:8080/pageflow_tutorial">http://localhost:8080/pageflow_tutorial</fork></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>
@@ -510,14 +514,14 @@
<p>You will be forwarded to the displayData.jsp page. Notice
the values you entered are displayed.</p>
</section>
</section>
- <section id="summary">
+<!-- <section id="summary">
<title>Summary: Page Flow Tutorial</title>
<p>This tutorial introduced you to the basics of building web
applications with Beehive Page Flows.</p>
<p>Concepts and Tasks Introduced in This Tutorial</p>
<p>
[TODO: complete summary]
</p>
- </section>
+ </section>-->
</body>
<footer>
<legal>Java, J2EE, and JCP are trademarks or registered trademarks of
Sun Microsystems, Inc. in the United States and other countries.<br/>