Author: ekoneil
Date: Wed Aug 24 21:52:08 2005
New Revision: 239994
URL: http://svn.apache.org/viewcvs?rev=239994&view=rev
Log:
Checkpoint the databinding document. The top is new, the bottom is not. :)
BB: self
DRT: build.release pass
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/pageflow/databinding.xml
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.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=239994&r1=239993&r2=239994&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 21:52:08 2005
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
"http://forrest.apache.org/dtd/document-v20.dtd">
-
<document>
<header>
<title>Data binding to NetUI Implicit Objects</title>
@@ -9,18 +8,58 @@
<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>
+ In NetUI, data binding is the what happens when binding JSP tags
or other UI technologies to data that
+ is available in the web-tier environment. This document discusses
both the the <em>implicit objects</em> that
+ are available via NetUI to the JSP author and the <em>expression
languages</em> that are used to bind UI
+ objects to those implicit objects.
+ </p>
+ <p>
+ NetUI tags support binding to both <em>read-only</em> and
<em>read-write</em> data. Read-only data is usually
+ bound to tag attributes that simply display information on a page.
Read-write data is bound with the inteition
+ of being updated from a web browser. Often, read-write data is
displayed within an HTML form tag and bound to
+ HTML text boxes, radio buttons, select boxes, and other HTML
widget types. Each of these types of binding
+ use the syntax of the JSP 2.0 Expression Language (EL) to express
a binding from JSP tag to JavaBean property,
+ Map member, List item, array element, and so on. The JSP 2.0
Expression Language is used to bind read-only
+ data to tag attributes. This language is documented in detail <a
href="site:jspel">here</a>. For example,
+ this example binds a NetUI <code>span</code> tag to a value from a
JSP's PageContext attribute map:
+ </p>
+ <source><![CDATA[
+ <netui:span value="${pageScope.fooAttribute}"/>
+ ]]></source>
+ <p>
+ Here, the JSP container evaluates the expression and invokes the
<code>span</code> tag's <code>setValue</code>
+ attribute method to pass the result to the tag. The JSP 2.0 EL is
also able to perform simple arithmetic
+ and boolean operations in expressions.
+ </p>
+ <p>
+ When using the NetUI JSP tags, read-write data is bound to NetUI
JSP tags differently. NetUI tags use a derivation
+ of the JSP 2.0 EL to refer to implicit objects in a JSP, but
unlike the JSP 2.0 EL, the syntax is slightly different.
+ For example, when binding a NetUI <code>textBox</code> tag to data
that is meant to be read and then updated during an
+ HTML form POST, the <code>textBox</code> tag might look like:
+ </p>
+ <source><![CDATA[
+ <netui:textBox dataSource="actionForm.userName"/>
+ ]]></source>
+ <p>
+ This expression syntax is used on NetUI JSP tag attributes named
<code>dataSource</code>. The expression syntax is
+ necessary to allow the NetUI tags to know <em>both</em> the value
of the expression and the expression text. The
+ expression text is needed in order to write the tag's name in the
HTML rendered to a web browser. For example,
+ with a <code>userName</code> of "foo", the JSP tag above will
render:
+ </p>
+ <source><![CDATA[
+ <input type="text" name="{actionForm.userName}"/>
+ ]]></source>
+ <p>
+ The expression text is used by the <code>textBox</code> tag to
render the value of the HTML <code>input</code>'s
+ <code>name</code> attribute, and when the containing HTML form
POSTs, this name is used to detect the presence of
+ a NetUI expression that can then be used to update a property on a
JavaBean or other data structure.
+ </p>
+ <note label="Best Practice">
+ In order to prevent POSTing data into JSP implicit objects such as
<code>requestScope</code> or <code>sessionScope</code>,
+ only a few NetUI implicit objects should be used in read/write
expressions. These include <code>pageFlow</code>, <code>sharedFlow</code>,
+ and <code>actionForm</code>.
+ </note>
<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>
@@ -455,7 +494,19 @@
</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>
+ <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>
+ <section id="el-details">
+ <title>Expression Language Details</title>
+ <p>
+ Due to limitations in the JSP 2.0 Expression Language
specification, expressions can not be used to reference
+ read-write data because the JSP tag itself can never obtain both
the expression text and the value of the
+ expression
+ </p>
+ </section>
</body>
</document>
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml
URL:
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml?rev=239994&r1=239993&r2=239994&view=diff
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml
(original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml
Wed Aug 24 21:52:08 2005
@@ -139,6 +139,7 @@
<n181 href="?id=181"/>
<n175 href="?id=175"/>
</jsr>
+ <jspel
href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html"/>
<java5download href="http://java.sun.com/j2se/1.5.0/download.jsp"/>
<annotationprocessing
href="http://java.sun.com/j2se/1.5.0/docs/guide/apt/"/>
<ant16 href="http://ant.apache.org/">