BEA Logo BEA WLCS Release 3.5

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WLCS Documentation   |   Webflow and Pipeline Management   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Webflow and Pipeline JSP Tags Library Reference

 

The BEA WebLogic Commerce Server product provides JSP tags specifically related to the Webflow and Pipeline mechanisms. This topic explains how to import each set of tags into your Web pages, and describes what each of these tags can do.

This topic includes the following sections:

 


Webflow JSP Tags

The Webflow JSP tags are utility tags that simplify the implementation of JSPs that utilize the Webflow mechanism. To import the Webflow JSP tags, use the following code:

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

Note: For more information about the Webflow mechanism, see Overview of Webflow and Pipeline Management, in this guide.

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:getValidatedValue>

The <webflow:getValidatedValue> tag (Table 5-1) is used in a JSP to display the fields in a form that a customer must correct. The <webflow:getValidatedValue> tag is used in tandem with the<webflow:setValidatedValue> tag.

Table 5-1 <webflow:getValidatedValue>

Tag Attribute

Required

Type

Description

R/C

fieldName

Yes

String

The name of the field for which the status is desired.

R

fieldValue

Yes

String

The value as entered by the user.

R

fieldDefaultValue

No

String

The default value to use if the field value is missing.

R

fieldStatus

Yes

String

The status of the field.

Valid values are:
unspecified-Field was left blank; user must enter some data.
invalid-User data is wrong.
valid-User data is okay.

R

invalidColor

No

String

The color with which the label for an invalid field is to be marked. 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

unspecifiedColor

No

String

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

R

fieldColor

No

String

The background color of the field.

R

fieldMessage

No

String

Specific message fo the current field.

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.

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
invalidColo
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 user indicating which pieces are valid/invalid as returned from the input processor.

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

<webflow:setValidatedValue>

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

Table 5-2 <webflow:setValidatedValue>

Tag Attribute

Required

Type

Description

R/C

fieldName

Yes

String

The name of the field for which the status is desired.

C

fieldValue

Yes

String

The new value of the field.

C

fieldStatus

No

String

The processing status of the field.

Valid values are:
unspecified-Field was left blank; user must enter some data.
invalid-User data is wrong.
valid-User data is okay.

C


 

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" />

About the ValidatedValues Java Class

The ValidatedValues class allows a Java/EJB programmer who writes an InputProcessor to report the status of processed form fields back to the commerce engineer/JSP content developer.

The constructor for the ValidatedValues class takes an HTTPServletRequest as a parameter, as shown in the following method signature:

public ValidatedValues (javax.servlet.http.HttpServletRequest s)

The public methods used to convey the status of the validation through the getValidatedValue and setValidatedValue JSP tags are shown in Table 5-3.

Table 5-3 ValidatedValues Public Methods

Method Signature

Description

public String getStatus (String name)

Retrieves the status for the specified field, which may be unspecified, invalid, or valid.

public void setStatus (String name, String value)

Sets the status for the specified field.

public String getValue (String name)

Retrieves the current value for the specified field.

public void setValue (String name, String value)

Sets the value for the specified field.


 

 


Pipeline JSP Tags

The Pipeline JSP tags are used to store and retrieve attributes in a Pipeline session. To import the Pipeline JSP tags, use the following code:

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

Note: For more information about the Webflow mechanism, see Overview of Webflow and Pipeline Management, in this guide.

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.

<pipeline:getPipelineProperty>

The <pipeline:getPipelineProperty> tag (Table 5-4) retrieves a named attribute (property) from the Pipeline session object, from a property of one of the objects that has been retrieved from the Pipeline session, or from the request. Objects that are stored as attributes of the Pipeline session must conform to the standard bean interface and implement a get<Attribute>() method for each publicly accessible attribute.
If propertyName does not exist in the Pipeline session, then returnName contains null.

Table 5-4 <pipeline:getPipelineProperty>

Tag Attribute

Required

Type

Description

R/C

propertyName

No

String

The key in the PipelineSession hash table that identifies what property value to get.

If omitted, the PipelineSession itself is returned.

R

pipelineObject

No

Object

Name of the object in which to search for the key specified as propertyName. If no object is specified, the default is to look in Pipeline session.

R

returnName

No

String

Name of the variable that will contain the value of the attribute.

If omitted, the tag is created inline (that is, the variable is not returned but the toString() method is called and the results are displayed to the browser).

R

returnType

No

String

A valid type for the returned attribute. If this is not specified, the value is returned as an object.

R

attributeScope

No

Int

The scope in which to look for the key specified as propertyName.

Valid values are:

PipelineConstants.SESSION_SCOPE

PipelineConstants.REQUEST_SCOPE

R


 

Example

When used in a JSP, this sample code will retrieve an attribute named <property_name> and store it in a variable named <return_name>. The type of this variable will be <return_type>, and the scope to which this attribute belongs is specified by <attribute_scope>.

<pipeline:getPipelineProperty propertyName="<property_name>" returnName="<return_name>" returnType="<return_type>" attributeScope="<%=<attribute_scope>%>"/>

Note: For more information about the scope of Pipeline session attributes, see the section Attribute Scoping in this guide.

<pipeline:setPipelineProperty>

The <pipeline:setPipelineProperty> tag (Table 5-5) sets a named attribute (property) to the Pipeline session object or to a property of one of the objects that has been retrieved from the Pipeline session. Objects that are stored as attributes of the Pipeline session must conform to the standard bean interface and implement a set<propertyName>() method for each publicly accessible attribute. Scope defaults to PipelineConstants.SESSION_SCOPE.

Table 5-5 <pipeline:setPipelineProperty>

Tag Attribute

Required

Type

Description

R/C

propertyName

Yes

String

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

R

propertyValue

Yes

Object

The value to associate with the propertyName.

R

pipelineObject

No

Object

Name of the object in the Pipeline session in which to store the given key and value pair.

R


 

If pipelineObject is not specified, then the given property and its value will be set to the Pipeline session. If the pipelineObject is specified, then the object must implement the set<PropertyName>() method, which takes two parameters: a property name (String) and a property value (Object), as shown in the following method signature:

public void set<PropertyName>(String propertyName,java.lang.Object propertyValue);

Note: If the set<PropertyName>()method is not implemented, an exception will be thrown during the processing of the JSP that has the setPipelineProperty tag in it.

Example

When used in a JSP, this sample code will set the property named <property_name> of the <pipeline_object_name> with the value specified in <property_value>.

<pipeline:setPipelineProperty propertyName="<property_name>" propertyValue="<property_value>" pipelineObject="<pipeline_object_name>"/>

Note: The <pipeline_object_name> must be a fully qualified class name.

 

back to top previous page