|
|
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.
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.
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.
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.
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.
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.
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|