Author: dolander
Date: Tue Aug 30 15:07:07 2005
New Revision: 264878
URL: http://svn.apache.org/viewcvs?rev=264878&view=rev
Log:
Update to the Form Controls document
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsHtmlMapping.xml
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
URL:
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml?rev=264878&r1=264877&r2=264878&view=diff
==============================================================================
---
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
(original)
+++
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
Tue Aug 30 15:07:07 2005
@@ -36,6 +36,7 @@
<tr><td><netui:textArea></td><td><code>java.lang.String[]</code></td></tr>
<tr><td><netui:textBox></td><td><code>java.lang.String[]</code></td></tr>
</table>
+ <p></p>
<section id="ExampleLink">
<title>NetUI Form Controls Example</title>
<p>All of the code fragments in this topic come from a single
example. The example
@@ -101,9 +102,12 @@
</p>
<source><![CDATA[
<table>
- <tr><th align="right">CheckBox [boolean]</th><td><netui:checkBox
dataSource="actionForm.checkBox"/></td></tr>
- <tr><th align="right">CheckBox [java.lang.Boolean]</th><td><netui:checkBox
dataSource="actionForm.checkBoxBoolean"/></td></tr>
- <tr><th align="right">CheckBox [java.lang.String]</th><td><netui:checkBox
dataSource="actionForm.checkBoxString"/></td></tr>
+ <tr><th align="right">CheckBox [boolean]</th>
+ <td><netui:checkBox dataSource="actionForm.checkBox"/></td></tr>
+ <tr><th align="right">CheckBox [java.lang.Boolean]</th>
+ <td><netui:checkBox dataSource="actionForm.checkBoxBoolean"/></td></tr>
+ <tr><th align="right">CheckBox [java.lang.String]</th>
+ <td><netui:checkBox dataSource="actionForm.checkBoxString"/></td></tr>
</table>
]]></source>
<p> In the <code>FormData</code>, the following three
properties are being bound to by the above
@@ -174,23 +178,197 @@
public void setCheckBoxGroup(String[] checkBoxGroup) {
this.checkBoxGroup = checkBoxGroup;
}
-
</source>
</section>
<section id="CheckBoxOption">
<title>CheckBoxOption</title>
+ <p>The <code><netui:checkBoxOption></code> is a tag that
defines a item within a
+ <code><netui:checkBoxGroup</code>. An has a required
<code>value</code> attribute
+ which defines the value that will be posted back when the
generated checkbox is
+ selected. There is also an optional <code>label</code>
attribute that defines
+ a text label for the checkbox. if the <code>label</code>
is not specified the
+ <code>value</code> attributes value will be used.
+ </p>
+ <p> In the CheckBoxGroup defined below, there are four
<code><netui:checkBoxOptions></code>
+ tags. All of them specify just the <code>value</code>
attribute.
+ </p>
+ <source><![CDATA[
+<netui:checkBoxGroup dataSource="actionForm.checkBoxGroup"
orientation="vertical">
+ <netui:checkBoxOption value="Check One"/>
+ <netui:checkBoxOption value="Check Two"/>
+ <netui:checkBoxOption value="Check Three"/>
+ <netui:checkBoxOption value="Check Four"/>
+</netui:checkBoxGroup>
+]]></source>
</section>
<section id="FileUpload">
<title>FileUpload</title>
+ <p> The <code><fileUpload></code> tag allows a file to be
uploaded to the server. By
+ default, this tag is not enabled because multipart request
handling is disabled.
+ The only supported
+ data type that can be bound to is
<code>org.apache.struts.upload.FormFile</code>. If
+ multipart handling is enabled, when the form is submitted,
the contents of the file
+ will be posted to the server.
+ </p>
+ <p> By default, multipart request handling is disabled. There
are two ways to enable
+ handling, you may turn it on for the WebApp by setting a
configuration option in the
+ <code>beehive-netui-config.xml</code> file or you may turn
it on for a page flow
+ by setting the Jpf.MultipartHandler annotation.
+ </p>
+ <p> In the example below, the
<code><netui:fileUpload></code> tag is used to upload
+ a file to the server. In order to use the file upload tag
you must set the
+ <code>enctype</code> on the <code><netui:form</code> to
<code>multipart/form-data</code>.
+ This is required to enable multipart data. The
<code>dataSource</code> is bound
+ to a property of type
<code>org.apache.struts.upload.FormFile</code>.
+ </p>
+ <source>
+<netui:form action="submit" <strong>enctype="multipart/form-data"</strong>>
+ ...
+ <netui:fileUpload dataSource="actionForm.fileUpload"/>
+</netui:form>
+ </source>
+ <p> The following is the <code>FormData</code> property that
will recieve the
+ information and data associated with the file that was
uploaded.
+ </p>
+ <source>
+private FormFile fileUpload;
+
+public FormFile getFileUpload() {
+ return fileUpload;
+}
+public void setFileUpload(FormFile fileUpload) {
+ this.fileUpload = fileUpload;
+}
+ </source>
+ <p> In this example, multipart handling was enabled for
in-memory support using
+ an annotation on the page flow.
+ </p>
+ <source>
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="formTest.jsp")
+ },
+ <strong>multipartHandler=Jpf.MultipartHandler.memory</strong>
+)
+ </source>
+ <p> The following modification to the
<code>beehive-netui-config.xml</code> file will
+ turn on in-memory processing of multipart requests for the
entire WebApp. See
+ the <a
href="site:config_description">beehive-netui-config.xml File Reference</a>
+ for information on creating an initial
<code>beehive-netui-config.xml</code>.
+ </p>
+ <source>
+<pageflow-config>
+ <multipart-handler>memory</multipart-handler>
+</pageflow-config>
+ </source>
</section>
<section id="Form">
<title>Form</title>
+ <p>The <code><netui:form></code> tag creates the HTML
<code><form></code> element.
+ It specifies the action to run in the page flow. If the
action has specifies a
+ parameter that is a
+ subclass of <code>FormData</code> a bean will be populated
by the page flow framework
+ with values posted by the controls contained in the form.
In the example below,
+ the form will call the page flow <code>submit</code>
action.
+ </p>
+ <source>
+<netui:form <strong>action="submit"</strong> enctype="multipart/form-data">
+ ...
+</netui:form>
+ </source>
+ <p> The following action defined in the page flow controller
will be called when the
+ form is submitted. An instance of <code>FormBean</code>
is created and populated
+ by the contents of the request.
+ </p>
+ <source>
[EMAIL PROTECTED](
+ [EMAIL PROTECTED](name="success",
+ path="results.jsp",
+ [EMAIL PROTECTED](name="bean", type=FormBean.class, required=true)}
+ )
+ }
+)
+public Forward submit(FormBean formBean) {
+ Forward fwd = new Forward("success", "bean", formBean);
+ return fwd;
+}
+
+ </source>
</section>
<section id="Hidden">
<title>Hidden</title>
+ <p> The <code><netui:hidden></code> tag creates the HTML
<code><input type="hidden"></code>
+ element. There is no visual representation of a hidden
field, but it's <code>value</code>
+ will be posted to the server when the form is posted. The
<code><netui:hidden></code>
+ is a bit different than other form controls. It contains
both a <code>dataInput</code>
+ and a <code>dataSource</code> attribute. This allows
binding a value from a source
+ that differs from what is posted back to the server. If
the <code>dataInput</code> is
+ not set, the <code>dataSource</code> is used as a
read/write binding.
+ </p>
+ <p> In the example below, there are a number of hidden fields
defined. All of them bind
+ values out of the <code>pageFlow</code> implicit object
(see the
+ <a href="site:databinding">Data binding to NetUI Implicit
Objects</a> for more
+ information. In the example, hidden binds to different
types of data objects.
+ The first simply binds the value back to a
<code>java.lang.String</code>
+ value. The second and third hidden fiels bind to the same
array of
+ <code>java.lang.String</code>s. The final hidden binds to
a boolean value.
+ </p>
+ <source><![CDATA[
+<table>
+ <tr><th align="right">Hidden</th>
+ <td><netui:hidden dataInput="${pageFlow.hidden}"
dataSource="actionForm.hidden"/></td></tr>
+ <tr><th align="right">Hidden Array[0]</th>
+ <td><netui:hidden dataInput="${pageFlow.hiddenArray[0]}"
dataSource="actionForm.hiddenArray"/></td></tr>
+ <tr><th align="right">Hidden Array[1]</th>
+ <td><netui:hidden dataInput="${pageFlow.hiddenArray[1]}"
dataSource="actionForm.hiddenArray"/></td></tr>
+ <tr><th align="right">Hidden</th>
+ <td><netui:hidden dataInput="${pageFlow.hiddenBoolean}"
dataSource="actionForm.hiddenBoolean"/></td></tr>
+</table>
+]]></source>
+ <p> The following properties are defined in the
<code>FormData</code> and are set
+ by the above hidden elements when the form is submitted.
+ </p>
+ <source>
+// hidden
+private String hidden;
+private String[] hiddenArray;
+private boolean hiddenBoolean;
+
+public String getHidden() {
+ return hidden;
+}
+public void setHidden(String hidden) {
+ this.hidden = hidden;
+}
+
+public String[] getHiddenArray() {
+ return hiddenArray;
+}
+public void setHiddenArray(String hiddenArray[]) {
+ this.hiddenArray = hiddenArray;
+}
+
+public boolean isHiddenBoolean() {
+ return hiddenBoolean;
+}
+public void setHiddenBoolean(boolean hiddenBoolean) {
+ this.hiddenBoolean = hiddenBoolean;
+}
+ </source>
</section>
<section id="ImageButton">
<title>ImageButton</title>
+ <p> The <code><netui:imageButton></code> creates the HMTL
<code><input type="image"</code>
+ element. The result is a image is used to submit the
form. The source of the image
+ is specified in the <code>src</code> attribute. The
ImageButton does not bind to any
+ data. In addition, it must appear inside of the form.
+ </p>
+ <source>
+<netui:form>
+ ...
+ <netui:imageButton src="insert.gif"/>
+</netui:form>
+ </source>
</section>
<section id="RadioButtonGroup">
<title>RadioButtonGroup</title>
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
URL:
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml?rev=264878&r1=264877&r2=264878&view=diff
==============================================================================
---
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
(original)
+++
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
Tue Aug 30 15:07:07 2005
@@ -33,7 +33,8 @@
@Jpf.Controller(
simpleActions={
@Jpf.SimpleAction(name="begin", path="formTest.jsp")
- }
+ },
+ multipartHandler=Jpf.MultipartHandler.memory
)
public class Controller extends PageFlowController
{
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsHtmlMapping.xml
URL:
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsHtmlMapping.xml?rev=264878&r1=264877&r2=264878&view=diff
==============================================================================
---
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsHtmlMapping.xml
(original)
+++
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsHtmlMapping.xml
Tue Aug 30 15:07:07 2005
@@ -37,10 +37,16 @@
<td><a href="site:pageflow_tag_formControls_checkbox">Form
Controls</a></td>
</tr>
<tr>
- <td><input
type=file></td><td>netui:fileUpload</td><td>Form Control allowing a file to be
uploaded</td><td></td>
+ <td><input
type=file></td><td>netui:fileUpload</td><td>Form Control allowing a file to be
uploaded</td>
+ <td><a
href="site:pageflow_tag_formControls_fileupload">Form Controls</a></td>
</tr>
<tr>
- <td><input
type=hidden></td><td>netui:hidden</td><td>Form Control that posts a value
back</td><td></td>
+ <td><form></td><td>netui:form</td><td>A form containing
a set of controls that can be posted to the server.</td>
+ <td><a href="site:pageflow_tag_formControls_form">Form
Controls</a></td>
+ </tr>
+ <tr>
+ <td><input
type=hidden></td><td>netui:hidden</td><td>Form Control that posts a value
back</td>
+ <td><a href="site:pageflow_tag_formControls_hidden">Form
Controls</a></td>
</tr>
<tr>
<td><html></td><td>netui:html</td><td>The containing
HTML tag.</td>
@@ -53,7 +59,8 @@
<td><a><img></a></td><td>netui:imageAnchor</td><td>A composite HTML
with an anchor surrounding an image</td><td></td>
</tr>
<tr>
- <td><input
type=image></td><td>netui:imageButton</td><td>Form Control that creates a
graphical button</td><td></td>
+ <td><input
type=image></td><td>netui:imageButton</td><td>Form Control that creates a
graphical button</td>
+ <td><a
href="site:pageflow_tag_formControls_imagebutton">Form Controls</a></td>
</tr>
<tr>
<td><label></td><td>netui:label</td><td>Create a label
to attach information to a Form Control</td><td></td>
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=264878&r1=264877&r2=264878&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
Tue Aug 30 15:07:07 2005
@@ -37,6 +37,11 @@
<pageflow_tag_formControls_button href="#Button" />
<pageflow_tag_formControls_checkbox href="#CheckBox" />
<pageflow_tag_formControls_checkboxgroup
href="#CheckBoxGroup" />
+ <pageflow_tag_formControls_checkboxoption
href="#CheckBoxOption" />
+ <pageflow_tag_formControls_fileupload href="#FileUpload" />
+ <pageflow_tag_formControls_form href="#Form" />
+ <pageflow_tag_formControls_hidden href="#Hidden" />
+ <pageflow_tag_formControls_imagebutton href="#ImageButton"
/>
</pageflow_tag_formControls>
<pageflow_tag_formControls_example
href="netui/tagsFormControlsExample.html"/>
<pageflow_tag_xhtml label="HTML/XHTML Support"
href="netui/tagsXhtml.html">
@@ -113,6 +118,7 @@
<taglib label="JSP Tags" href="apidocs/taglib/index.html"/>
<config label="beehive-netui-config.xml"
href="netui/config/beehive-netui-config.html">
<config_doctype href="#doctype" />
+ <config_description href="#desc" />
<config_id_javascript href="#id-javascript" />
</config>
</netui>