bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

JavaServer Page Guide

 Previous Next Contents View as PDF  

Navigation (Webflow) JSP Tags

The WebLogic Portal product suite includes a set of JSP tags designed to facilitate the development of JSPs using Webflow. Use of these predefined tags will eliminate the need for your JSPs to contain any Java code related to Webflow. This topic explains how to import this set of tags into your Web pages, and describes the purpose of each tag.

This topic includes the following sections:

 


URL Creation Tags

The Webflow URL tags described in this section are used to create dynamic or static URLs for links and other resources within a JSP.

Note: In the following tables, the Required column specifies if the attribute is required (yes) or optional (no). In the R/C column, C means that the attribute is a Compile time expression, and R means that the attribute can be either a Request time expression or a Compile time expression.

<webflow:createWebflowURL>

The <webflow:createWebflowURL> tag (Table  4-1) is used in a JSP to dynamically create a Webflow URL in a JSP. The Webflow URL may include the protocol, domain name, port, Web application URI, WebflowServlet URI, and query string.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Class Implemented

CreateWebflowURLTag


 


 

Table  4-1 describes the <webflow:createWebflowURL> tag attributes.


 

Table 4-1 <webflow:createWebflowURL>  

Tag Attribute

Required

Type

Description

R/C

domainName

No

String

Used to change the domain name or IP address of the URL. This may be used if Webflow is fronted by a proxy server and that server resides on another machine.

R

doRedirect

No

String

Causes the WebflowServlet to perform a redirect instead of a forward to a presentation node. Valid values are true and false. The default is false (not to redirect).

R

encode

No

String

Informs Webflow to encode the URL. URLs need to be encoded if you wish to maintain session state and the browser does not accept cookies. Valid values are true and false. The default value is determined by the value of ENCODE_URLS set in the web app's web.xml file. URLs will only need to be encoded if the browser does not accept cookies. See "Encoding Webflow URLs"for more information.

R

escape

No

String

Tells Weblfow to escape the URL. URLs must be escaped if they will contain any characters (with some exceptions - see below) that would be encoded using java.net.URLEncoder.encode(). Note however that even when escaping is on the entire URL is not encoded rather the URL will be tokenized using the characters ':', '/', '?', '=', and '&' then the substrings between the tokens are encoded using java.net.URLEncoder.encode(). The tokenizing is necessary so that the URL will still be recognized by the Webflow engine.

Valid values for this attribute are 'NO', 'YES' or 'CALCULATE'.

Escaping is relatively costly and should be avoided if possible but is required if the URL might have any characters other then those ignored by java.net.URLEncoder.encode(), that is any characters other than 'a' through 'z', 'A' through 'Z, '0' through '9', '-', '_', '.', or '*' with the exception of the tokenizing characters mentioned above. If the content of the URL will not be determined until runtime and might contain "illegal" characters you should use either 'YES' or 'CALCULATE'. 'CALCULATE' should be used with care.


escape (con't)

No

String

(Continued from previous page)

For sites that have a small number of URLs that will need escaping using 'CALCULATE' rather then 'YES' will result in a performance improvement. But, since 'CALCULATE' first checks the URL then encodes if needed, sites where most URLs need escaping will have poorer performance using 'CALCULATE' rather then 'YES'.

If omitted the default value for escaping is determined by the value of ESCAPE_URLS in the web app's web.xml file. See "Encoding Webflow URLs" for more information.


event

Yes

String

Webflow will use this in combination with the origin to resolve a destination in the supplied namespace XML file.

R

extraParams

No

String

Used to supply additional request parameters as name/value pairs.

R

httpsInd

No

String

Informs Webflow to calculate the protocol or use HTTPS or HTTP. Valid values are calculate, http, and https.

Calculate will yield HTTPS if any node in the origin/event branch chain list is matched under the HTTPS_URL_PATTERNS context parameter in the application's WEB-INF/web.xml file. Calculate is more dynamic and expensive, but if the protocol needs to be forced you can specify it here.

If a value is not set for this attribute, the context-param value for HTTPSIND_DEFAULT_VALUE in web.xml is used. If no value is found there, calculate is used.

If an invalid value is used for this attribute, calculate is used.

The following example shows a protocol set in web.xml. This value would be used if no JSP tag attribute is set.

<context-param>
<param-name>HTTPSIND_DEFAULT_VALUE</param-name>
<param-value>HTTPS</param-value>
</context-param>

The possible values of HTTP, HTTPS or CALCULATE can be specified in all uppercase or all lowercase.

R

namespace

No

String

Indicates which Webflow configuration file the origin and event are defined in. If omitted, then the current (last successful) namespace is used.

R

origin

No

String

The node where the event will be coming from. Origins follow the node-name.node-type format. This may or may not be equal to the page name. If omitted, then the JSP page name is used.

R

pathPrefix

No

String

Used to prefix the path information. This string will be placed in front of the Web application URI. This can be used when the proxy server is located on the same machine.

Note: The proxy must strip the path prefix before forwarding the request to Webflow.

R

pathSuffix

No

String

Used to suffix the path information. The additional path information will be placed after the WebflowServlet URI. This information can then be retrieved via the request.getPathInfo() method.

R


 

Example

Listing  4-1 illustrates how to use the <webflow:createWebflowURL> JSP tag and its many attributes:

Note: It is recommended that you not hardcode values on a Web page.

Listing 4-1 Using <webflow:createWebflowURL> Tag and Attributes

<a href="<webflow:createWebflowURL event='link.yo' pathSuffix='/morepath' 
/>">A Path Suffix</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' pathPrefix='/pathprefix' />">A Path Prefix</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' pathPrefix='/pathprefix' pathSuffix='/suffix' />">A Path Prefix and Path Suffix</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' domainName='123.123.123.123' />">A Domain Name</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' pathSuffix='/morepath' extraParams='sex=male' />">A Path Suffix and One Extra Parameter</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' pathSuffix='/morepath' extraParams='sex=male&animal=dog' />">A Path Suffix and Two Extra Parameters</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' httpsInd='https' />">Always Use HTTPS</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' httpsInd='http' />">Always Use HTTP</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' httpsInd='calculate' />">Calculate HTTPS</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' encode='false' />">Do Not Encode the URL</a>
<br>
<a href="<webflow:createWebflowURL event='link.yo' doRedirect='true' />">Redirect, Instead of Forward</a> 
<br>

<webflow:createResourceURL>

The <webflow:createResourceURL> tag (Table  4-2) is used in a JSP to create a static URL for a resource, using the value of the P13N_STATIC_ROOT context parameter in the application's WEB-INF/web.xml file. This tag may be used to load GIF images from a separate server.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Class Implemented

CreateResourceURLTag


 


 

Table  4-2

Table 4-2 <webflow:createResourceURL>  

Tag Attribute

Required

Type

Description

R/C

encode

No

Boolean

Informs Webflow to encode the URL. URLs need to be encoded if you wish to maintain session state and the browser does not accept cookies. Valid values are true and false. The default value is determined by the value of ENCODE_STATIC_URLS set in the web app's web.xml file. URLs will only need to be encoded if the browser does not accept cookies. See "Encoding Webflow URLs" for more information.

R

escape

No

String

Tells Weblfow to escape the URL. URLs must be escaped if they will contain any characters (with some exceptions - see below) that would be encoded using java.net.URLEncoder.encode(). Note however that even when escaping is on the entire URL is not encoded rather the URL will be tokenized using the characters ':', '/', '?', '=', and '&' then the substrings between the tokens are encoded using java.net.URLEncoder.encode(). The tokenizing is necessary so that the URL will still be recognized by the Webflow engine.

Valid values for this attribute are 'NO', 'YES' or 'CALCULATE'.

Escaping is relatively costly and should be avoided if possible but is required if the URL might have any characters other then those ignored by java.net.URLEncoder.encode(), that is any characters other than 'a' through 'z', 'A' through 'Z, '0' through '9', '-', '_', '.', or '*' with the exception of the tokenizing characters mentioned above. If the content of the URL will not be determined until runtime and might contain "illegal" characters you should use either 'YES' or 'CALCULATE'. 'CALCULATE' should be used with care.


escape (con't)

No

String

(Continued from previous page)

For sites that have a small number of URLs that will need escaping using 'CALCULATE' rather then 'YES' will result in a performance improvement. But, since 'CALCULATE' first checks the URL then encodes if needed, sites where most URLs need escaping will have poorer performance using 'CALCULATE' rather then 'YES'.

If omitted the default value for escaping is determined by the value of ESCAPE_STATIC_URLS in the web app's web.xml file. See "Encoding Webflow URLs" for more information.


resource

No

String

Relative path to the file or image.

R

describes the <webflow:createResourceURL> tag attributes.

Example

Listing  4-2 illustrates how you can use the <webflow:createResourceURL> JSP tag to point to a specific resource, in this case, a .gif file.

Listing 4-2 Using <webflow:createResourceURL>

<img src="<webflow:createResourceURL 
resource="/images/button_checkout.gif"/>" border="0" alt="Proceed
To Checkout" border="0"></a>

 


Form Tags

The Webflow JSP form tags described in this section are used to create simple dynamic links for form actions.

Note: In the following tables, the Required column specifies if the attribute is required (yes) or optional (no). In the R/C column, C means that the attribute is a Compile time expression, and R means that the attribute can be either a Request time expression or a Compile time expression.

<webflow:form>

The <webflow:form> tag is used in a JSP to dynamically generate an HTML form tag. This tag is not as sophisticated as the <webflow:validatedForm> tag, but is simpler.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Class Implemented

WebflowFormTag


 

Note: This tag does not support the embedded Webflow form tags like the <webflow:validatedForm> does.

Table  4-3 lists the <webflow:form> tag attributes.

Table 4-3 <webflow:form>  

Tag Attribute

Required

Type

Description

R/C

domainName

No

String

Used to change the domain name or IP address of the URL. This may be used if Webflow is fronted by a proxy server and that server resides on another machine.

R

doRedirect

No

String

Causes the WebflowServlet to perform a redirect instead of a forward to a presentation node. Valid values are true and false. The default is false (not to redirect).

R

encode

No

String

Informs Webflow to encode the URL. URLs need to be encoded if you wish to maintain session state and the browser does not accept cookies. Valid values are true and false. The default value is determined by the value of ENCODE_URLS set in the web app's web.xml file. URLs will only need to be encoded if the browser does not accept cookies. See "Encoding Webflow URLs" for more information.

R

escape

No

String

Tells Weblfow to escape the URL. URLs must be escaped if they will contain any characters (with some exceptions - see below) that would be encoded using java.net.URLEncoder.encode(). Note however that even when escaping is on the entire URL is not encoded rather the URL will be tokenized using the characters ':', '/', '?', '=', and '&' then the substrings between the tokens are encoded using java.net.URLEncoder.encode(). The tokenizing is necessary so that the URL will still be recognized by the Webflow engine.

Valid values for this attribute are 'NO', 'YES' or 'CALCULATE'.

Escaping is relatively costly and should be avoided if possible but is required if the URL might have any characters other then those ignored by java.net.URLEncoder.encode(), that is any characters other than 'a' through 'z', 'A' through 'Z, '0' through '9', '-', '_', '.', or '*' with the exception of the tokenizing characters mentioned above. If the content of the URL will not be determined until runtime and might contain "illegal" characters you should use either 'YES' or 'CALCULATE'. 'CALCULATE' should be used with care.


escape (con't)

No

String

(Continued from previous page)

For sites that have a small number of URLs that will need escaping using 'CALCULATE' rather then 'YES' will result in a performance improvement. But, since 'CALCULATE' first checks the URL then encodes if needed, sites where most URLs need escaping will have poorer performance using 'CALCULATE' rather then 'YES'.

If omitted the default value for escaping is determined by the value of ESCAPE_URLS in the web app's web.xml file. See "Encoding Webflow URLs" for more information.


event

Yes

String

Webflow will use this in combination with the origin to resolve a destination in the supplied namespace XML file.

R

extraParams

No

String

Used to supply additional request parameters as name/value pairs.

R

hide

No

String

If set to false, the namespace, origin, and event will be displayed on the command line instead of as hidden form fields.
Valid values are true and false. The default value is true.

R

httpsInd

No

String

Informs Webflow to calculate the protocol or use HTTPS or HTTP. Valid values are calculate, http, and https.

Calculate will yield HTTPS if any node in the origin/event branch chain list is matched under the HTTPS_URL_PATTERNS context parameter in the application's WEB-INF/web.xml file. Calculate is more dynamic and expensive, but if the protocol needs to be forced you can specify it here.

If a value is not set for this attribute, the context-param value for HTTPSIND_DEFAULT_VALUE in web.xml is used. If no value is found there, calculate is used.

If an invalid value is used for this attribute, calculate is used.

The following example shows a protocol set in web.xml. This value would be used if no JSP tag attribute is set.

<context-param>
<param-name>HTTPSIND_DEFAULT_VALUE</param-name>
<param-value>HTTPS</param-value>
</context-param>

The possible values of HTTP, HTTPS or CALCULATE can be specified in all uppercase or all lowercase.

R

method

No

String

The method to be used for the form. Valid values are get and post. The default value is post.

R

name

No

String

The name of the form.

R

namespace

No

String

Indicates which Webflow configuration file the origin and event are defined in. If omitted, then the current (last successful) namespace is used.

R

origin

No

String

The node where the event will be coming from. Origins follow the node-name.node-type format. This may or may not be equal to the page name. If omitted, then the JSP page name is used.

R

pathPrefix

No

String

Used to prefix the path information. This string will be placed in front of the Web application URI. This can be used when the proxy server is located on the same machine.

Note: The proxy must strip the path prefix before forwarding the request to Webflow.

R

pathSuffix

No

String

Used to suffix the path information. The additional path information will be placed after the WebflowServlet URI. This information can then be retrieved via the request.getPathInfo() method.

R

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R


 

Example

Listing  4-3 illustrates how to use the <webflow:form> JSP tag:

Listing 4-3 Using <form>

<webflow:form event="button.go" > 
<input type="text" name="username" >
</webflow:form>

 


Validated Form Tags

The Webflow's validated form JSP tags are used to dynamically generate HTML forms that can be validated. These tags work in conjunction with an Input Processor and the ValidatedValues class, described in the Javadoc. When a Web site visitor enters invalid information, the visitor's input is preserved and redisplayed with an appropriate error message.

<webflow:validatedForm>

The <webflow:validatedForm> tag is used in a JSP to dynamically create the URL that defines the action in an HTML form. This tag should be used in conjunction with the com.bea.p13n.appflow.webflow.forms.* package and the other nested form tags defined in the webflow.tld file (which are described later in this section).

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

WebflowValidatedFormTag

WebflowValidatedFormTagExtraInfo


 

Table  4-4 describes the <webflow:validatedForm> tag attributes.

Table 4-4 <webflow:validatedForm>  

Tag Attribute

Required

Type

Description

R/C

applyStyle

No

String

Applies the associated CCS style as indicated by the field status to the message, the field, or to none. Therefore, valid values are message, field, and none. The default value is message.

See also:

invalidStyle

styleId

validStyle

unspecifiedStyle

R

domainName

No

String

Used to change the domain name or IP address of the URL. This may be used if Webflow is fronted by a proxy server and that server resides on another machine.

R

doRedirect

No

String

Causes the WebflowServlet to perform a redirect instead of a forward to a presentation node. Valid values are true and false. The default is false (not to redirect).

R

encode

No

String

Informs Webflow to encode the URL. URLs need to be encoded if you wish to maintain session state and the browser does not accept cookies. Valid values are true and false. The default value is determined by the value of ENCODE_URLS set in the web app's web.xml file. URLs will only need to be encoded if the browser does not accept cookies. See "Encoding Webflow URLs" for more information.

R

escape

No

String

Tells Weblfow to escape the URL. URLs must be escaped if they will contain any characters (with some exceptions - see below) that would be encoded using java.net.URLEncoder.encode(). Note however that even when escaping is on the entire URL is not encoded rather the URL will be tokenized using the characters ':', '/', '?', '=', and '&' then the substrings between the tokens are encoded using java.net.URLEncoder.encode(). The tokenizing is necessary so that the URL will still be recognized by the Webflow engine.

Valid values for this attribute are 'NO', 'YES' or 'CALCULATE'.

Escaping is relatively costly and should be avoided if possible but is required if the URL might have any characters other then those ignored by java.net.URLEncoder.encode(), that is any characters other than 'a' through 'z', 'A' through 'Z, '0' through '9', '-', '_', '.', or '*' with the exception of the tokenizing characters mentioned above. If the content of the URL will not be determined until runtime and might contain "illegal" characters you should use either 'YES' or 'CALCULATE'. 'CALCULATE' should be used with care.


escape (con't)

No

String

(Continued from previous page)

For sites that have a small number of URLs that will need escaping using 'CALCULATE' rather then 'YES' will result in a performance improvement. But, since 'CALCULATE' first checks the URL then encodes if needed, sites where most URLs need escaping will have poorer performance using 'CALCULATE' rather then 'YES'.

If omitted the default value for escaping is determined by the value of ESCAPE_URLS in the web app's web.xml file. See "Encoding Webflow URLs" for more information.


event

Yes

String

Webflow will use this in combination with the origin to resolve a destination in the supplied namespace XML file.

R

extraParams

No

String

Used to supply additional request parameters as name/value pairs.

R

hide

No

String

If set to false, the namespace, origin, and event will be displayed on the command line instead of as hidden form fields.
Valid values are true and false. The default value is true.

R

httpsInd

No

String

Informs Webflow to calculate the protocol or use HTTPS or HTTP. Valid values are calculate, http, and https.

Calculate will yield HTTPS if any node in the origin/event branch chain list is matched under the HTTPS_URL_PATTERNS context parameter in the application's WEB-INF/web.xml file. Calculate is more dynamic and expensive, but if the protocol needs to be forced you can specify it here.

If a value is not set for this attribute, the context-param value for HTTPSIND_DEFAULT_VALUE in web.xml is used. If no value is found there, calculate is used.

If an invalid value is used for this attribute, calculate is used.

The following example shows a protocol set in web.xml. This value would be used if no JSP tag attribute is set.

<context-param>
<param-name>HTTPSIND_DEFAULT_VALUE</param-name>
<param-value>HTTPS</param-value>
</context-param>

The possible values of HTTP, HTTPS or CALCULATE can be specified in all uppercase or all lowercase.

R

invalidStyle

No

String

The CSS style used to format the HTML field or the message when the field is invalid.

R

messageAlign

No

String

Indicates whether to align the error message above the field, to the right of the field, or below the field. Therefore, value values are top, right, and bottom. The default value is right.

R

method

No

String

The method to be used for the form. Valid values are get and post. The default value is post.

R

name

No

String

The name of the form.

R

namespace

No

String

Indicates which Webflow configuration file the origin and event are defined in. If omitted, then the current (last successful) namespace is used.

R

origin

No

String

The node where the event will be coming from. Origins follow the node-name.node-type format. This may or may not be equal to the page name. If omitted, then the JSP page name is used.

R

pathPrefix

No

String

Used to prefix the path information. This string will be placed in front of the Web application URI. This can be used when the proxy server is located on the same machine.

Note: The proxy must strip the path prefix before forwarding the request to Webflow.

R

pathSuffix

No

String

Used to suffix the path information. The additional path information will be placed after the WebflowServlet URI. This information can then be retrieved via the request.getPathInfo() method.

R

styleId

No

String

Scripting variable that will be set to one of invalidStyle, unSpecifiedStyle, or validStyle, depending on the field's status: valid, invalid, unspecified. Can be used for finer control of formatting the HTML form.

R

unspecifiedStyle

No

String

Used to specify the intial CSS style of the HTML field before validation occurs.

R

validStyle

No

String

The CSS style used to format the HTML field when it is valid.

R

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R


 

Example

Listing  4-4 illustrates how to use the <webflow:validatedForm> JSP tag to dynamically create the URL that defines the action in an HTML form..

Listing 4-4 Using <webflow:validatedForm>

<%
moreAttributes = "ENCTYPE=\"multipart/form-data\"";
%>
<p> use enctype="multipart/form-data" and hide="false"...
<br>
<webflow:validatedForm name="uploadFeedback"
htmlAttributes='<%= moreAttributes %>'
hide="false"
event="uploadFeedback.submit"
namespace="test_forms" >
<webflow:text size="50" name="testText"value="startingDefaultValue" />
<input type="submit" name="SubmitButton" value="SubmitButtonLabel" />
</webflow:validatedForm>

<webflow:text>

The <webflow:text> tag is used in a JSP to validate an HTML text field. This tag must be nested in the <webflow:validatedForm> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

TexTag


 

Table  4-5 describes the <webflow:text> tag attributes.

Table 4-5 <webflow:text>  

Tag Attribute

Required

Type

Description

R/C

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R

maxlength

No

String

The maximum length of the text field.

R

name

Yes

String

The name of the text field.

R

retainValue

No

String

Determines whether or not the text field should retain its input upon redisplay. Valid values are true and false.

R

size

No

String

The size of the text field.

R

style

No

String

The HTML CSS style associated with the text field.

R

value

No

String

The initial value of the text field.

R


 

<webflow:password>

The <webflow:password> tag is similar to the <webflow:text> tag except that field input is masked with asterisks (****). This tag must be nested in the <webflow:validatedForm> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

PasswordTag


 

Table 4-6 <webflow:password>  

Tag Attribute

Required

Type

Description

R/C

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R

maxlength

No

String

The maximum length of the password field.

R

name

Yes

String

The name of the password field.

R

retainValue

No

String

Determines whether or not the password field should retain its input upon redisplay. Valid values are true and false. The default value is false.

R

size

No

String

The size of the password field.

R

style

No

String

The HTML CSS style associated with the password field.

R

value

No

String

The initial value of the password field.

R


 

<webflow:radio>

The <webflow:radio> tag is used in a JSP to represent an HTML radio button, but preserves the input. This tag must be nested in the <webflow:validatedForm> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

RadioTag


 

Table  4-7 describes the <webflow:radio> tag attributes.

Table 4-7 <webflow:radio>  

Tag Attribute

Required

Type

Description

R/C

checked

No

String

Determines whether or not the radio button is initially selected. Valid values are true and false. The default value is false.

R

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R

name

Yes

String

The name of the radio button field.

R

value

Yes

String

The initial value of the radio button field.

R


 

<webflow:checkbox>

The <webflow:checkbox> tag is used in a JSP to generate the required HTML for a check box. This tag will preserve input upon the InputProcessor throwing an InvalidFormFieldException. This tag must be nested in the <webflow:validatedForm> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

CheckboxTag


 

Table  4-8 describes the <webflow:checkbox> tag attributes.

Table 4-8 <webflow:checkbox>  

Tag Attribute

Required

Type

Description

R/C

checked

No

String

Determines whether or not the check box field is initially selected. Valid values are true and false. The default value is false.

R

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R

name

Yes

String

The name of the check box field.

R

value

Yes

String

The initial value of the check box field.

R


 

<webflow:textarea>

The <webflow:textarea> tag is used in a JSP to represent an HTML text area, but preserves the input. This tag must be nested in the <webflow:validatedForm> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

TextareaTag


 

Table 4-9 <webflow:textarea>  

Tag Attribute

Required

Type

Description

R/C

cols

No

String

The number of columns for the text area.

R

name

Yes

String

The name of the text area.

R

retainValue

No

String

Determines whether or not the text area should retain its input upon redisplay. Valid values are true and false.

R

rows

No

String

The number of rows for the text area.

R

style

No

String

The HTML CSS style associated with the text area.

R

value

No

String

The initial value of the text area.

R

wrap

No

String

Determines whether or not the text area should wrap input. Valid values are true and false. The default value is true.

R

Table  4-9 describes the <webflow:textarea> tag attributes.

<webflow:select>

The <webflow:select> tag is used in a JSP to represent a list box, but preserves its input. This tag must be nested in the <webflow:validatedForm> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

SelectTag


 

Table 4-10 <webflow:select>  

Tag Attribute

Required

Type

Description

R/C

htmlAttributes

No

String

Additional HTML attributes. Any attribute not supported directly can be supplied here.

R

multiple

No

String

Determines whether or not the list box allows multiple selections. Valid values are true and false. The default value is false.

R

name

Yes

String

The name of the list box.

R

size

No

String

The size of the list box.

R

style

No

String

The HTML CSS style attribute.

R

Table  4-10 describes the <webflow:select> tag atttibutes.

<webflow:option>

The <webflow:option> tag (Table  4-11) is used in a JSP to represent an HTML option, but preserves the input. An option is one value in a list box. This tag must be nested in the <webflow:select> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

OptionTag


 

Table  4-11 describes the

Table 4-11 <webflow:option>  

Tag Attribute

Required

Type

Description

R/C

selected

No

String

Determines whether or not the option is initially selected. Valid values are true and false. The default value is false.

R

style

No

String

The HTML style attribute.

R

value

Yes

String

The value the option represents.

R

<webflow:option> tag attributes.

Example

Listing  4-5 uses each of the validated form tags in an HTML form page that gathers some information about a Web site's visitors.

Listing 4-5 Using webflow.tld Form Tags

<%@ taglib uri="webflow.tld" prefix="webflow" %>
<% String validStyle="background: white; color: black; font-family: Arial"; %> 
<% String invalidStyle="background: white; color: red; font-style: italic"; %>
<%-- If there was an InvalidFormDataException thrown, display the message --%> 
<font size="5" color="green"><webflow:getException/></font> 
<br>
<webflow:validatedForm event="button.go" applyStyle="message" 
messageAlign="right" validStyle="<%=validStyle%>"
invalidStyle="<%=invalidStyle%>" unspecifiedStyle="<%=validStyle%>" >
<p>
Username: 
<webflow:text name="username" value="start" size="15" maxlength="30"
htmlAttributes="onMouseOver=\\"self.status='User ID';return true\\"" />
<br>
Password: 
<webflow:password name="password" size="15" retainValue="true" maxlength="30"
htmlAttributes="onMouseOver=\\"self.status='Secret Password';return true\\"" />
<br>
Sex: 
<webflow:radio name="sex" checked="true" value="M"/>Male
<webflow:radio name="sex" value="F" />Female
<br>
Favorite Pet(s):
<webflow:checkbox name="cat" value="cat" />Cat <br>
<webflow:checkbox name="dog" checked="true" value="dog" />Dog <br>
<webflow:checkbox name="bird" value="bird" />Bird
<p>
Comment:
<webflow:textarea name="comment" cols="20" rows="3" value="hello" />
<br>
Hobbies:
<webflow:select name="hobbies" size="3" multiple="true">
<webflow:option value="Running"/>Running
<webflow:option value="Skiing"/>Skiing
<webflow:option value="Motocross"/>MotoX
<webflow:option value="Rugby"/>Rugby
</webflow:select>
<br>
<input type="submit" name="Submit"/> 
</webflow:validatedForm> 

 


Pipeline Session Tags

A Pipeline Session is used to share information between Input Processors, Pipeline Components, and presentation nodes. The Pipeline Session JSP tags are used to retrieve and set properties in the Pipeline Session. Presentation nodes (such as JSPs) are typically used to retrieve information from the Pipeline Session, while Input Processors and Pipeline Components place properties into the Pipeline Session. There are, however, JSP tags for setting properties in the Pipeline Session.

<webflow:setProperty>

The <webflow:setProperty> tag sets a property in the Pipeline Session.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

SetPropertyTag


 

Table  4-12 describes the <webflow:setProperty> tag attributes.

Table 4-12 <webflow:setProperty>  

Tag Attribute

Required

Type

Description

R/C

namespace

No

String

Use the namespace attribute to force webflow to use a particular webflow configuration file defining a specific origin and event. If omitted then the current namespace (last successful namespace) is used.

R

property

Yes

String

Name or key with which the given property is to be associated.

R

scope

No

String

The scope of the property. Valid values are session and request. The default value is session.

R

value

Yes

Object

The value to associate with the property, specified as an object name or Java expression.

R

Example

Listing  4-6 illustrates how to use the <webflow:setProperty> JSP tag to set some arbitrary object in the Pipeline Session (Request-scoped):

Listing 4-6 Using <webflow:setProperty>

<% SomeObject so = new SomeObject("TWO"); %>
<webflow:setProperty property="myobject" value="<%= so %>" scope="request" />

<webflow:getProperty>

The <webflow:getProperty> tag (Table  4-13) retrieves a named property from the Pipeline Session. This tag can be inlined or return a scripting variable.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

GetPropertyTag

Table  4-13 describes the

Table 4-13 <webflow:getProperty>  

Tag Attribute

Required

Type

Description

R/C

namespace

No

String

Use the namespace attribute to force webflow to use a particular webflow configuration file defining a specific origin and event. If omitted then the current namespace (last successful namespace) is used.

R

id

No

Object

Java scripting variable to receive the instance of the returned object. If omitted, the toString() method will be called on the object and the results will be displayed in the browser.

R

property

Yes

String

The name or key of the property to obtain from the Pipeline Session.

R

scope

No

String

The scope of the property, which can be request or session. Request-scoped properties can improve performance, especially in a cluster because they do not need to be replicated. Valid values are session and request. The default value is session.

R

type

No

String

A Java class name, which can be used to cast your exception.

R

<webflow:getProperty> tag attributes.

Example 1

The following code sample shows how you can use the <webflow:getProperty> JSP tag inline. The toString() method is called on the instance of SomeObject:

result = <webflow:getProperty property="myobject" scope="request" /> 

Example 2

Listing  4-7 on page  4-34 shows how to use the <webflow:getProperty> JSP tag to return a scripting variable of type SomeObject.

Listing 4-7 Using <webflow:getProperty>; Example 2

<webflow:getProperty id="myObj" property="myobject" type="com.bea.test.SomeObject" scope="request" /> 
result = <%= myObj.getValue() %>

<webflow:setValidatedValue>

The <webflow:setValidatedValue> tag (Table  4-14) is used in a JSP to configure the display of fields in a form that a Web site visitor must correct. Usually this is done within an Input Processor, but it can also be done from a JSP by using this tag. The <webflow:setValidatedValue> tag is used in tandem with the <webflow:getValidatedValue> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

setValidatedValueTag


 

Note: You might want to consider using the <webflow:validatedForm> tags instead of <webflow:setValidatedValue> as it supports the validatedValues class from previous releases. However, if some low-level functionality needs to be accessed, then these tags are still valid.

Table  4-14 describes the <webflow:setValidatedValue> tag attributes.

Table 4-14 <webflow:setValidatedValue>

Tag Attribute

Required

Type

Description

R/C

fieldName

No

String

The name of the field for which the status is desired. This should match the HTML form field name.

R

fieldStatus

No

String

The processing status of the field. Valid values are:
unspecified—Field was left blank; Web site visitor must enter some data.
invalid—Data is entered incorrectly.
valid—Data is entered correctly.

R

fieldValue

No

String

The new value of the field.

R


 

Example

When used in a JSP, this sample code will obtain the current value and processing status of the <field_name> form field.

<webflow:setValidatedValue fieldName="<field_name>" fieldValue="<field_value>" fieldStatus="status" />

<webflow:getValidatedValue>

The <webflow:getValidatedValue> tag) is used in a JSP to display the fields in a form that a Web site visitor must correct. The <webflow:getValidatedValue> tag is used in tandem with the<webflow:setValidatedValue> tag.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

getValidatedValueTag


 

Note: You may want to consider using the <webflow:validatedForm> tags instead of <webflow:getValidatedValue>, as it supports the ValidatedValues class from previous releases. However, if some low-level functionality needs to be accessed, then these tags are still valid.

Table  4-15 describes the <webflow:getValidatedValue> tag attributes.

Table 4-15 <webflow:getValidatedValue>  

Tag Attribute

Required

Type

Description

R/C

fieldColor

No

String

Scripting variable set to one of invalidColor, validColor, or unspecifiedColor (depending on the status). This can be used to change the color of the field or message.

R

fieldDefaultValue

No

String

The default value to use if the fieldValue is missing.

R

fieldMessage

No

String

A scripting variable used to provide a specific message for the current field.

R

fieldName

Yes

String

The name of the field for which the status is desired. This should match the HTML form field name.

R

fieldStatus

Yes

String

The status of the field. Valid values are:
unspecified—Field was left blank; Web site visitor must enter some data.
invalid—Data is entered incorrectly.
valid—Data is entered correctly.

R

fieldValue

Yes

String

Scripting variable representing the value of the form field.

R

invalidColor

No

String

The color with which the label for an invalid field is to be marked. Defaults to red.

R

unspecified
Color

No

String

If the Web site visitor leaves a required field blank, this will be the color of the label for that field. Defaults to red.

R

validColor

No

String

The color with which the label for a valid field is to be marked. Defaults to black.

R


 

These fields are determined and marked by an Input Processor after performing its validation activities. All InputProcessors use a ValidatedValues object to communicate which fields were successfully processed as well as those that were determined to be invalid. For more information, see the Javadoc.

Example 1

When used in a JSP, this sample code will obtain the current value and processing status of the <field_name> form field.

<webflow:getValidatedValue fieldName="<field_name>" fieldValue="<field_value>" fieldStatus="status" />

Example 2

The <webflow:getValidatedValue> tag refers to the webflow.tld tag library to retrieve available elements/attributes. In this example, a request is being made to obtain the following values from the HTTP session:

fieldName
fieldValue
fieldStatus
validColor
invalidColor
unspecifiedColor
fieldColor

These attributes are used for display purposes. (In this case, indicate that this field is required and mark it in red.) The overall goal is to display values back to the Web site visitor, indicating which pieces are valid/invalid as returned from the Input Processor, as shown in Listing  4-8.

Listing 4-8 Using <webflow:getValidatedValue>; Example 2

<webflow:getValidatedValue
fieldName="<%=HttpRequestConstants.CUSTOMER_FIRST_NAME%>"
fieldValue="customerFirstName" fieldStatus="status" validColor="black"
invalidColor="red" unspecifiedColor="black" fieldColor="fontColor"
/>

<webflow:getException>

The <webflow:getException> tag is used to retrieve the exception or message thrown by a Webflow processor. This can be the message associated with an InvalidFormFieldException exception or a ProcessingException exception. This tag can be inlined (in which it calls the getMessage() method on the exception) or return a scripting variable representing the exception.

Tag Library

webflow.tld

Import Statement

<%@ taglib uri="webflow.tld"
prefix="webflow" %>

Classes Implemented

getExceptionTag


 

Table  4-16 describes the <webflow:getException> tag attributes.

Table 4-16 <webflow:getException>  Tag Attributes

Tag Attribute

Required

Type

Description

R/C

id

Yes

Exception

Java scripting variable, which can be used to retrieve an instance of the exception.

R

type

No

String

Java class name, which can be used to cast the exception.

R


 

Example

Listing  4-9 illustrates how to use the <webflow:getException> JSP tag:

Listing 4-9 Using <webflow:getException>

<%-- If there was an InvalidFormDataException thrown, display the message --%>
<font size="5" color="red"><webflow:getException/></font>

 

Back to Top Previous Next