BEA Logo BEA WebLogic Commerce Server Release 3.1.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WebLogic Commerce Server Doc Home   |   Webflow and Pipeline Management   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Webflow and Pipeline JSP Tags

 

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.

getValidatedValue Tag

The getValidatedValue tag is used in a JSP to display the fields in a form that a customer must correct. Table 4-1 describes the attributes that can be used with the getValidatedValues JSP tag.

Table 4-1 getValidatedValues Tag Attributes

Attribute

Description

Required?

fieldName

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

Yes

fieldValue

The current value of the field as set by a previous invocation of the page.

No

fieldStatus

The processing status of the field, which may be unspecified, invalid, or valid.

No

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.

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 HTTPSession as a parameter, as shown in the following method signature:

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

The public methods used to convey the status of the validation through the getValidatedValue JSP tag are shown in Table 4-2.

Table 4-2 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.

Example

Listing 4-1 provides an example of how you might use the getValidatedValue tag. When used in a JSP, this sample code will obtain the current value and processing status of the <field_name> form field.

Listing 4-1 Example Usage of the getValidatedValue Tag


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


 


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 Pipeline mechanism, see Overview of Webflow and Pipeline Management.

getPipelineProperty Tag

The getPipelineProperty JSP tag 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.

Table 4-3 describes the attributes that can be used with the getPipelineProperty JSP tag.

Table 4-3 getPipelineProperty Tag Attributes

Attribute

Description

Required?

attributeScope

Scope of the attribute to locate. (PipelineConstants.PIPELINE_SESSION_SCOPE or PipelineConstants.REQUEST.SCOPE)

No

pipelineObject

Name of the object in the Pipeline session in which to locate the specified attribute.

No

propertyName

Name of the attribute to locate. If omitted, the Pipeline session itself is returned.

No

returnName

Name of the variable that will contain the value of the attribute. If omitted, then the tag is treated as inline (that is, the variable is not returned but the toString() method is called and the results are displayed to the browser).

No

returnType

A valid type for the returned attribute.

No

Example

Listing 4-2 provides an example of how you might use the getPipelineProperty tag. 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>.

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

Listing 4-2 Example Usage of the getPipelineProperty Tag


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


setPipelineProperty Tag

The setPipelineProperty JSP tag 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.

Table 4-4 describes the attributes that can be used with the setPipelineProperty JSP tag.

Table 4-4 setPipelineProperty Tag Attributes

Attribute

Description

Required?

pipelineObject

Name of the object in the Pipeline session in which to set the specified attribute.

No

propertyName

Name of the attribute to set.

Yes

propertyValue

Value of the attribute to set.

Yes

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

Listing 4-3 provides an example of how you might use the setPipelineProperty tag. 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>.

Listing 4-3 Example Usage of the setPipelineProperty Tag


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


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