You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/24 21:34:43 UTC
svn commit: r239738 -
/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml
Author: ekoneil
Date: Wed Aug 24 12:34:37 2005
New Revision: 239738
URL: http://svn.apache.org/viewcvs?rev=239738&view=rev
Log:
Checkpoint databinding.xml before going back in to rewrite some stuff.
BB: self
DRT: build.release pass
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml
Modified: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml?rev=239738&r1=239737&r2=239738&view=diff
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml (original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml Wed Aug 24 12:34:37 2005
@@ -1,276 +1,281 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
+ "http://forrest.apache.org/dtd/document-v20.dtd">
+
<document>
- <header>
- <title>Databinding: Passing Data Between Controller Classes and JSP Pages</title>
- </header>
- <body>
- <section id="intro">
- <title>Introduction</title>
- <p>Your web application's presentation layer (JSP pages) and processing layer
- (Controller classes) are bound together through the process of <em>databinding</em>.
- There are numerous databinding contexts available, including all
- of the JSP 2.0 implicit objects as well as other contexts peculiar to
- page flow apps.</p>
- <p>Databinding syntax uses the JSP 2.0 Expression Language. For a quick summary of the
- JSP 2.0 EL see <a href="http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html" class="fork">JSP 2.0: The New Deal, Part 1</a>.</p>
- <p>It is important to note that the databinding contexts form a two-way street between the
- presentation and processing layers of a web application. Databinding contexts not
- only pass data from the processing layer to the presentation layer, some contexts
- can pass data in the opposite direction from the presentation layer to the processing layer.
- </p>
- <p>The one-way, read-only contexts are: requestScope, param, sessionScope, container, pageScope, bundle, pageInput, applicationScope</p>
- <p>The two-way, read-write contexts are: pageFlow, sharedFlow, actionForm</p>
- </section>
- <section id="contexts">
- <title>Summary of Binding Contexts</title>
- <table>
- <tr>
- <th>Context Name</th>
- <th>Object the Context References</th>
- <th>Description</th>
- </tr>
- <tr>
- <td>
- <code>actionForm</code>
- </td>
- <td>The current form bean (the form bean named in the
- current <code><netui:form></code> tag)</td>
- <td>Individual fields defined in the form bean can be
- referenced. Values are read-write.</td>
- </tr>
- <tr>
- <td>
- <code>applicationScope</code>
- </td>
- <td>an attribute map on the application object (a JSP 2.0 implicit object)</td>
- <td>An implicit JSP object. Attributes of this object are available across the web
- app.</td>
- </tr>
- <tr>
- <td>
- <code>bundle</code>
- </td>
- <td>Properties defined in a message resource file</td>
- <td>On a JSP page, declare the message resource file using
- the <netui-data:declareBundle> tag. <source><netui-data:declareBundle name="myBundle" bundlePath="properties.bundle1"/></source>
- Reference individual properties in the file using the
- <code>bundle</code> databinding context. <source><netui:span value="${bundle.myBundle.message1}"/></source></td>
- </tr>
- <tr>
- <td>
- <code>container</code>
- </td>
- <td>The data set referenced in the current
- <netui-data:dataGrid> or <netui-data:repeater>
- tag</td>
- <td>In the example below, the <code>container</code>
- context refers to the object named in the
- <code><netui-data:dataGrid></code>'s
- <code>dataSource</code> <source><netui-data:dataGrid <strong>dataSource="pageScope.stocks"</strong> name="portfolio">
- <netui-data:rows>
- <netui-data:spanCell value="${<strong>container.item.symbol</strong>}"/>
- <netui-data:spanCell value="${<strong>container.item.price</strong>}"/>
- </netui-data:rows>
-</netui-data:dataGrid></source> See below for detailed
- information on <code>container</code>'s
- sub-contexts.</td>
- </tr>
- <tr>
- <td>
- <code>pageFlow</code>
- </td>
- <td>The current Controller class</td>
- <td>Public members of the current Controller class can be referenced and written to.
- Assume that the Controller class contains the following member String and
- associated get and set methods.
- <source>public String someText = "This is some text"
+ <header>
+ <title>Data binding to NetUI Implicit Objects</title>
+ </header>
+ <body>
+ <section id="introduction">
+ <title>Introduction</title>
+ <p>Your web application's presentation layer (JSP pages) and processing layer
+ (Controller classes) are bound together through the process of <em>databinding</em>.
+ There are numerous databinding contexts available, including all
+ of the JSP 2.0 implicit objects as well as other contexts peculiar to
+ page flow apps.</p>
+ <p>Databinding syntax uses the JSP 2.0 Expression Language. For a quick summary of the
+ JSP 2.0 EL see <a href="http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html" class="fork">JSP 2.0: The New Deal, Part 1</a>.</p>
+ <p>It is important to note that the databinding contexts form a two-way street between the
+ presentation and processing layers of a web application. Databinding contexts not
+ only pass data from the processing layer to the presentation layer, some contexts
+ can pass data in the opposite direction from the presentation layer to the processing layer.
+ </p>
+ <p>The one-way, read-only contexts are: requestScope, param, sessionScope, container, pageScope, bundle, pageInput, applicationScope</p>
+ <p>The two-way, read-write contexts are: pageFlow, sharedFlow, actionForm</p>
+ </section>
+ <section id="implicit-objects">
+ <title>Summary of NetUI Implict Objects</title>
+ <table>
+ <tr>
+ <th>Context Name</th><th>Object the Context References</th><th>Description</th>
+ </tr>
+ <tr>
+ <td>
+ <code>actionForm</code>
+ </td>
+ <td>
+ The current form bean (the form bean named in the current <code><netui:form></code> tag)
+ </td>
+ <td>
+ Individual fields defined in the form bean can be referenced. Values are read-write.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <code>applicationScope</code>
+ </td>
+ <td>an attribute map on the application object (a JSP 2.0 implicit object)</td>
+ <td>An implicit JSP object. Attributes of this object are available across the web
+ app.</td>
+ </tr>
+ <tr>
+ <td>
+ <code>bundle</code>
+ </td>
+ <td>Properties defined in a message resource file</td>
+ <td>On a JSP page, declare the message resource file using the <code><netui-data:declareBundle></code> tag.
+ <source><netui-data:declareBundle name="myBundle" bundlePath="properties.bundle1"/></source> Reference individual
+ properties in the file using the <code>bundle</code> databinding context. <source><netui:span value="${bundle.myBundle.message1}"/></source></td>
+ </tr>
+ <tr>
+ <td>
+ <code>container</code>
+ </td>
+ <td>The data set referenced in the current <netui-data:dataGrid> or <netui-data:repeater>
+ tag</td>
+ <td>In the example below, the <code>container</code> context refers to the object named in the
+ <code><netui-data:dataGrid></code>'s <code>dataSource</code> <source><![CDATA[
+<netui-data:dataGrid <strong>dataSource="pageScope.stocks"</strong> name="portfolio">
+ <netui-data:rows>
+ <netui-data:spanCell value="${<strong>container.item.symbol</strong>}"/>
+ <netui-data:spanCell value="${<strong>container.item.price</strong>}"/>
+ </netui-data:rows>
+</netui-data:dataGrid>
+]]></source> See below for detailed information on <code>container</code>'s sub-contexts.</td>
+ </tr>
+ <tr>
+ <td>
+ <code>pageFlow</code>
+ </td>
+ <td>The current Controller class</td>
+ <td>Public members of the current Controller class can be referenced and written to. Assume that the
+ Controller class contains the following member String and associated get and set methods.
+ <source>
+public String someText = "This is some text"
+
public String getSomeText(){
return someText;
}
public void setSomeText(String newText){
someText = newText;
-}</source>
- Then that member can be referenced from any JSP page in the page flow.
- <source><netui:span value="${pageFlow.someText}"/></source></td>
- </tr>
- <tr>
- <td>
- <code>pageInput</code>
- </td>
- <td>an attribute map on the current Forward object</td>
- <td>Page input data can be added to the Forward object
- using the <code>addActionOutput(String, Object)
- method.</code>. <source>Forward forward = new Forward("success");
-forward.addActionOutput("name", someNameData);</source> The data can be retrieved on
- the JSP page using the <code>pageInput</code>
- databinding context. <source><netui:span value="${pageInput.name}"/></source></td>
- </tr>
- <tr>
- <td>
- <code>pageScope</code>
- </td>
- <td>an attribute map on the current JSP page (a JSP 2.0 implicit object)</td>
- <td>An implicit JSP object. Attributes of this object are available on the current JSP page.</td>
- </tr>
- <tr>
- <td>
- <code>requestScope</code>
- </td>
- <td>an attribute map on the request object (a JSP 2.0 implicit object)</td>
- <td>An implicit JSP object. Attributes of this object are available
- for the life of the current request.</td>
- </tr>
- <tr>
- <td>
- <code>sessionScope</code>
- </td>
- <td>an attribute map on the session object (a JSP 2.0 implicit object)</td>
- <td>An implicit JSP object. Attributes of this object are available
- for the life of the user session.</td>
- </tr>
- <tr>
- <td>
- <code>sharedFlow</code>
- </td>
- <td>Attribute map of all of the shared flows in the web application</td>
- <td>Provided that the shared flow is declared in the Controller file
- <source>@Jpf.Controller(
+}
+</source>
+ Then that member can be referenced from any JSP page in the page flow. <source><netui:span value="${pageFlow.someText}"/></source></td>
+ </tr>
+ <tr>
+ <td>
+ <code>pageInput</code>
+ </td>
+ <td>an attribute map on the current Forward object</td>
+ <td>Page input data can be added to the Forward object using the <code>addActionOutput(String, Object)
+ method.</code>.
+<source>
+Forward forward = new Forward("success");forward.addActionOutput("name", someNameData);
+</source>
+ The data can be retrieved on the JSP page using the <code>pageInput</code> databinding context.
+<source>
+ <netui:span value="${pageInput.name}"/>
+</source>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <code>pageScope</code>
+ </td>
+ <td>An attribute map on the current JSP page (a JSP 2.0 implicit object)</td>
+ <td>An implicit JSP object. Attributes of this object are available on the current JSP page.</td>
+ </tr>
+ <tr>
+ <td>
+ <code>requestScope</code>
+ </td>
+ <td>An attribute map on the request object (a JSP 2.0 implicit object)</td>
+ <td>An implicit JSP object. Attributes of this object are available for the life of the current request.</td>
+ </tr>
+ <tr>
+ <td>
+ <code>sessionScope</code>
+ </td>
+ <td>An attribute map on the session object (a JSP 2.0 implicit object)</td>
+ <td>An implicit JSP object. Attributes of this object are available for the life of the user session.</td>
+ </tr>
+ <tr>
+ <td>
+ <code>sharedFlow</code>
+ </td>
+ <td>Attribute map of all of the shared flows in the web application</td>
+ <td>Provided that the shared flow is declared in the Controller file
+ <source>
+@Jpf.Controller(
sharedFlowRefs={
@Jpf.SharedFlowRef(name="mySharedFlow", type=sharedFlows.SharedFlow.class)
}
)
-public class Controller extends PageFlowController
+public class Controller
+ extends PageFlowController
</source>
-You can access the members of the shared flow through the <code>sharedFlow</code> context.
-<source><netui:span value="${sharedFlow.mySharedFlow.someProperty}"/></source></td>
- </tr>
- <tr>
- <td>
- <code>param</code>
- </td>
- <td>Query parameters on the current JSP's URL.</td>
- <td>Query parameters that are part of the URL can be
- referenced. Values are read only.</td>
- </tr>
- </table>
- </section>
- <section id="individual_binding_contexts">
- <title>Individual Binding Contexts</title>
- <section id="actionForm">
- <title>
- <code>actionForm</code>
- </title>
- <p>To bind to data in a form bean, you use the <code>actionForm</code>
- context.
- In the following example a JSP's form fields are pre-populated
- by binding to the fields of a form bean.
+ You can access the members of the shared flow through the <code>sharedFlow</code> context.
+<source><![CDATA[
+<netui:span value="${sharedFlow.mySharedFlow.someProperty}"/>
+]]></source>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <code>param</code>
+ </td>
+ <td>Query parameters on the current JSP's URL.</td>
+ <td>Query parameters that are part of the URL can be referenced. Values are read only.</td>
+ </tr>
+ </table>
+ </section>
+ <section id="individual_binding_contexts">
+ <title>Individual Binding Contexts</title>
+ <section id="actionForm">
+ <title>
+ <code>actionForm</code>
+ </title>
+ <p>To bind to data in a form bean, you use the <code>actionForm</code>
+ context.
+ In the following example a JSP's form fields are pre-populated
+ by binding to the fields of a form bean.
Assume that you navigate to the JSP page via the following action method.
- Notice that the <code>Forward</code> object is constructed with
- two parameters: the first parameter is the string "update", the second
- parameter is a form bean (DatabaseForm). By constructing the
- Forward object in this way, the <code>actionForm</code> context
- is automatically filled with the form bean values, values which can
- be retrieved by the navigated-to JSP page.
+ Notice that the <code>Forward</code> object is constructed with
+ two parameters: the first parameter is the string "update", the second
+ parameter is a form bean (DatabaseForm). By constructing the
+ Forward object in this way, the <code>actionForm</code> context
+ is automatically filled with the form bean values, values which can
+ be retrieved by the navigated-to JSP page.
</p>
- <source>@Jpf.Action(
+ <source>
+@Jpf.Action(
forwards={
- @Jpf.Forward( name="update", path="updateItems.jsp" )
- }
+ @Jpf.Forward( name="update", path="updateItems.jsp" )
+ }
)
-public Forward updateItems(DatabaseForm form)
-{
+public Forward updateItems(DatabaseForm form) {
...
- // Read from the database
- // and apply the values to the form bean.
+ // Read from the database
+ // and apply the values to the form bean.
form.applyValuesToForm(getCurrentRow());
-
- // Construct a Forward object using the form bean.
+
+ // Construct a Forward object using the form bean.
return new Forward("update", form);
-}</source>
- <p>The action method above reads a record from a database using a
- Database control (the control code is omitted in the
- example) and populates the fields in the form bean with the
- record data before navigating to the JSP <code>updateItems.jsp</code>.
- The values are retrieved by the JSP page, using the <code>actionForm</code>
- context:</p>
- <source><netui:form action="submitUpdate">
- <netui:content value="${actionForm.itemnumber}"/>
- <netui:textBox dataSource="actionForm.itemname"/>
+}
+</source>
+ <p>The action method above reads a record from a database using a
+ Database control (the control code is omitted in the example) and populates the fields in the form bean with the
+ record data before navigating to the JSP <code>updateItems.jsp</code>.
+ The values are retrieved by the JSP page, using the <code>actionForm</code> context:</p>
+ <source><![CDATA[
+<netui:form action="submitUpdate">
+ <netui:content value="${actionForm.itemnumber}"/>
+ <netui:textBox dataSource="actionForm.itemname"/>
...
-</netui:form></source>
- <p>When the <netui:form> is submitted
- (<code>submitUpdate</code>), you can then write the updated
- values back to the database:</p>
- <source>@Jpf.Action(
+</netui:form>
+]]></source>
+ <p>When the <netui:form> is submitted (<code>submitUpdate</code>), you can then write the updated values back to the database:</p>
+ <source>
+@Jpf.Action(
forwards={
- @Jpf.Forward( name="updated", path="getItems.jsp" )
- }
+ @Jpf.Forward( name="updated", path="getItems.jsp" )
+ }
)
-public Forward submitUpdate(DatabaseForm aDatabaseForm)
-{
+public Forward submitUpdate(DatabaseForm aDatabaseForm) {
// code that calls the database control and updates the database
return new Forward("updated");
-}</source>
- </section>
- <section id="applicationScope">
- <title>
- <code>applicationScope</code>
- </title>
- </section>
- <section id="bundle">
- <title>
- <code>bundle</code>
- </title>
- </section>
- <section id="container">
- <title>
- <code>container</code>
- </title>
- <p>The <code>container</code> refers to the data set passed into a
- <netui-data> or <netui-data:repeater> tag. The <code>container</code>
- allows access to the individual rows and cells of the data set.</p>
- <p>The <code>container</code> context has the following properties.</p>
- <table>
- <tr>
- <td><strong>Property Name</strong></td>
- <td><strong>Description</strong></td>
- </tr>
- <tr>
- <td><code>container.item</code></td>
- <td>Refers to the current row of the data set.</td>
- </tr>
- <tr>
- <td><code>container.item.[field_name]</code></td>
- <td>Refers to an individual
- field of the current row.</td>
- </tr>
- <tr>
- <td><code>container.index</code></td>
- <td>Refers to the integer index of the current
- row.</td>
- </tr>
- </table>
- <p>The following example shows how to access the name, type breed, and weight properties
- in a data set passed to a data grid.</p>
- <p>The context <code>container</code> refers to the data set <code>pageInput.petList</code>.</p>
-<source><netui-data:dataGrid dataSource="<strong>pageInput.petList</strong>" name="petGrid">
- <netui-data:rows>
- <netui-data:spanCell value="${<strong>container.item.name</strong>}"/>
- <netui-data:spanCell value="${<strong>container.item.type</strong>}"/>
- <netui-data:spanCell value="${<strong>container.item.breed</strong>}"/>
- <netui-data:spanCell value="${<strong>container.item.weight</strong>}""/>
- </netui-data:rows>
-</netui-data:dataGrid></source>
- </section>
- <section id="pageFlow">
- <title>
- <code>pageFlow</code>
- </title>
- <p>When you define a variable in your controller class, you can access this
- variable from any JSP page that is part of that page flow by providing
- access with a getter and setter method. For example, if the JPF file
- contains this code:</p>
+}
+</source>
+ </section>
+ <section id="applicationScope">
+ <title>
+ <code>applicationScope</code>
+ </title>
+ </section>
+ <section id="bundle">
+ <title>
+ <code>bundle</code>
+ </title>
+ </section>
+ <section id="container">
+ <title>
+ <code>container</code>
+ </title>
+ <p>The <code>container</code> refers to the data set passed into a
+ <netui-data> or <netui-data:repeater> tag. The <code>container</code>
+ allows access to the individual rows and cells of the data set.</p>
+ <p>The <code>container</code> context has the following properties.</p>
+ <table>
+ <tr>
+ <td><strong>Property Name</strong></td>
+ <td><strong>Description</strong></td>
+ </tr>
+ <tr>
+ <td><code>container.item</code></td>
+ <td>Refers to the current row of the data set.</td>
+ </tr>
+ <tr>
+ <td><code>container.item.[field_name]</code></td>
+ <td>Refers to an individual field of the current row.</td>
+ </tr>
+ <tr>
+ <td><code>container.index</code></td>
+ <td>Refers to the integer index of the current row.</td>
+ </tr>
+ </table>
+ <p>The following example shows how to access the name, type breed, and weight properties
+ in a data set passed to a data grid.</p>
+ <p>The context <code>container</code> refers to the data set <code>pageInput.petList</code>.</p>
+<source><![CDATA[
+<netui-data:dataGrid dataSource="<strong>pageInput.petList</strong>" name="petGrid">
+ <netui-data:rows>
+ <netui-data:spanCell value="${<strong>container.item.name</strong>}"/>
+ <netui-data:spanCell value="${<strong>container.item.type</strong>}"/>
+ <netui-data:spanCell value="${<strong>container.item.breed</strong>}"/>
+ <netui-data:spanCell value="${<strong>container.item.weight</strong>}""/>
+ </netui-data:rows>
+</netui-data:dataGrid>
+]]></source>
+ </section>
+ <section id="pageFlow">
+ <title>
+ <code>pageFlow</code>
+ </title>
+ <p>When you define a variable in your controller class, you can access this
+ variable from any JSP page that is part of that page flow by providing
+ access with a getter and setter method. For example, if the JPF file
+ contains this code:</p>
<source> private String firstName;
@@ -282,25 +287,23 @@
firstName = aStr;
}</source>
-<p>You can access this variable on a JSP, for instance, you can bind the
- value to a netui:label as is shown next:</p>
+<p>You can access this variable on a JSP, for instance, you can bind the value to a netui:label as is shown next:</p>
-<source><netui:label value="${pageFlow.firstName}" /></source>
+<source><![CDATA[
+ <netui:label value="${pageFlow.firstName}"/>
+]]></source>
<p>In the example the method getFirstName is used to provide read access to the variable.
- The variable is read-write and can be changed, for instance in the controller's action
- method as is shown in the next example:</p>
+ The variable is read-write and can be changed, for instance in the controller's action method as is shown in the next example:</p>
<source>
-
@Jpf.Action(
forwards={
- @Jpf.Forward( name="success", path="nextPage.jsp" )
- }
+ @Jpf.Forward( name="success", path="nextPage.jsp" )
+ }
)
-public Forward labelAction(NameActionForm form)
-{
+public Forward labelAction(NameActionForm form) {
...
firstName = "Default Name";
return new Forward( "success");
@@ -309,18 +312,21 @@
<p>It can also be changed in a JSP by using a form, as is shown next:</p>
-<source> <netui:form action="submitAction">
- <netui:textBox dataSource="pageFlow.firstName"/>
+<source><![CDATA[
+<netui:form action="submitAction">
+ <netui:textBox dataSource="pageFlow.firstName"/>
...
- <netui:button value="submit"/>
- </netui:form></source>
+ <netui:button value="submit"/>
+ </netui:form>
+]]></source>
<p>You can also define and access variables that are part of an object created in the
- controller class. You can provide this access by again using getter and setter
- methods. For instance, if the JPF file contains the code:</p>
+ controller class. You can provide this access by again using getter and setter
+ methods. For instance, if the JPF file contains the code:</p>
-<source>public class dataFlowController extends PageFlowController
-{
+<source>
+public class dataFlowController
+ extends PageFlowController {
...
public Names myNames = new Names();
...
@@ -335,61 +341,70 @@
return lastName;
}
}
- ...</source>
+ ...
+</source>
<p>You can access the firstName property in a JSP like this:</p>
-<source><netui:label value="${pageFlow.myNames.firstName}" /></source>
+<source><![CDATA[
+<netui:label value="${pageFlow.myNames.firstName}" />
+]]></source>
<p>The comments in this section regarding access of page flow properties also apply to
- properties defined to the <a href="#sharedFlow"><code>sharedFlow</code></a> context.</p>
- </section>
- <section id="pageInput">
- <title>
- <code>pageInput</code>
- </title>
- <p>The <code>pageInput</code> context is filled with data by an action output
- in the Controller class.</p>
- <source>Forward f = new Forward("next_page");
+ properties defined to the <a href="#sharedFlow"><code>sharedFlow</code></a> context.</p>
+ </section>
+ <section id="pageInput">
+ <title>
+ <code>pageInput</code>
+ </title>
+ <p>The <code>pageInput</code> context is filled with data by an action output
+ in the Controller class.</p>
+ <source>Forward f = new Forward("next_page");
f.addActionOutput("message", sMessage);</source>
- <p>The data can be retrieved on the JSP page as follows:</p>
- <source><netui:span value="${pageInput.message}"/></source>
- </section>
- <section id="request">
- <title>
- <code>requestScope</code>
- </title>
- </section>
- <section id="session">
- <title>
- <code>sessionScope</code>
- </title>
+ <p>The data can be retrieved on the JSP page as follows:</p>
+ <source><![CDATA[
+<netui:span value="${pageInput.message}"/>
+ ]]></source>
+ </section>
+ <section id="request">
+ <title>
+ <code>requestScope</code>
+ </title>
+ </section>
+ <section id="session">
+ <title>
+ <code>sessionScope</code>
+ </title>
<p>You can use the <code>sessionScope</code> context to read data from the
- session object (an implicit JSP object). Assuming that the session object contains
- some data in its attribute map:</p>
+ session object (an implicit JSP object). Assuming that the session object contains
+ some data in its attribute map:</p>
-<source>getSession().setAttribute("myAttributeKey", myObject);</source>
+<source>
+ getSession().setAttribute("myAttributeKey", myObject);
+</source>
<p>then, you can read the data onto a JSP page as follows:</p>
-<source><netui:content value="${sessionScope.myAttributeKey.someProperty}"></netui:content></source>
-
- </section>
- <section id="sharedFlow">
- <title>
- <code>sharedFlow</code>
- </title>
+<source><![CDATA[
+ <netui:content value="${sessionScope.myAttributeKey.someProperty}"></netui:content>
+]]></source>
+ </section>
+ <section id="sharedFlow">
+ <title>
+ <code>sharedFlow</code>
+ </title>
<p>If you need an attribute to be available across all the page flows in a web application's
- user (browser) session, such as a user's unique session key, you can use shared flow.
- By convention, shared flows are located in WEB-INF/src/shared. (For details on creating
- a shared flow, see <a href="site:pageflow_sharedFlow">Shared Flow</a>.) In addition to
- session-wide attributes, you can also use the shared flow to define fallback action methods
- and exception handlers. </p>
+ user (browser) session, such as a user's unique session key, you can use shared flow.
+ By convention, shared flows are located in WEB-INF/src/shared. (For details on creating
+ a shared flow, see <a href="site:pageflow_sharedFlow">Shared Flow</a>.) In addition to
+ session-wide attributes, you can also use the shared flow to define fallback action methods
+ and exception handlers. </p>
<p>If you define a variable in the shared flow class:</p>
-<source>public class SharedFlow extends SharedFlowController
-{
+<source>
+public class SharedFlow
+ extends SharedFlowController {
public String defaultText = "Please Define";
public String getDefaultText(){
@@ -400,42 +415,47 @@
</source>
<p>and your controller file references the shared flow:</p>
-
-<source>@Jpf.Contoller(
+
+<source>
+@Jpf.Contoller(
sharedFlowsRefs = {
@Jpf.SharedFlowRef(name = "specificSharedFlow", type = "SharedFlow.class")
}
)
-public class SomeController extends Controller
-{
+public class SomeController
+ extends Controller {
...
-}</source>
-
+}
+</source>
+
<p>you can use the databinding context <code>sharedFlow</code> in a JSP file:</p>
-<source><netui:textBox dataSource="actionForm.firstName" defaultValue="${sharedFlow.specificSharedFlow.defaultText}"/></source>
+<source><![CDATA[
+<netui:textBox dataSource="actionForm.firstName" defaultValue="${sharedFlow.specificSharedFlow.defaultText}"/>
+]]></source>
-<p>Notice that the <netui:textBox> tag in the example binds to a form bean to post data and
- binds to sharedFlow's defaultText to receive its default value.</p>
-
+<p>Notice that the <netui:textBox> tag in the example binds to a form bean to post data and binds to sharedFlow's defaultText to receive its default value.</p>
+
<p>SharedFlow properties can be accessed from a JSP using the scope sharedFlow, for example,</p>
- <source>dataSource="sharedFlow.specificSharedFlow.someProperty"</source>
+<source>
+ dataSource="sharedFlow.specificSharedFlow.someProperty"
+</source>
<p>Actions declared in a SharedFlow are accessed by specifying a fully qualified action</p>
- <source>action="specificSharedFlow.someAction"</source>
-
- <p>where specificSharedFlow was the name given to the sharedFlow in the JPF
- annotation <code>Jpf.SharedFlowRef</code>.</p>
- </section>
- <section id="param">
- <title>
- <code>param</code>
- </title>
- </section>
- </section>
- <section id="related"><title>Related Topics</title>
- <p>For more information on the JSP 2.0 Expression Language, see <a href="http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html" class="fork">JSP 2.0: The New Deal, Part 1</a></p></section>
- </body>
+ <source>
+action="specificSharedFlow.someAction"
+</source>
+ <p>where specificSharedFlow was the name given to the sharedFlow in the JPF annotation <code>Jpf.SharedFlowRef</code>.</p>
+ </section>
+ <section id="param">
+ <title>
+ <code>param</code>
+ </title>
+ </section>
+ </section>
+ <section id="related"><title>Related Topics</title>
+ <p>For more information on the JSP 2.0 Expression Language, see <a href="http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html" class="fork">JSP 2.0: The New Deal, Part 1</a></p></section>
+ </body>
</document>