First Previous Next Last

Rules Guide  

Chapter 9   Rule JSP Tag Library

This chapter describes how to use the JSP tags contained in RuleTag.jar.

For more information    For background information, see the chapter on using the Director tag libraries in the Core Development Guide.

 
Top of section

doAction

Fires a Director action and returns the response phrase.

This tag wraps the doAction() method on the EbiAction interface and the getResponsePhrase() method on the EbiContext interface.

Syntax

  <prefix:doAction action="action" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

action

Yes

No

Specifies the class name for the action that will be fired.

id

No

No

Specifies the name of the variable that will be used to store the response phrase.

If no value is specified, the response phrase is inserted in the page at the location where the tag appears.

Example 1

This example shows how to use the doAction tag to insert an action's response phrase at the tag location:

  <% taglib uri="/re" prefix="re" %>
  ...
  Result of Action is...
  <re:doAction action="com.sssw.re.action.ReturnAsHtmlBold" />

Example 2

This example shows how to use the doAction tag to store an action's response phrase in a variable for further processing:

  <% taglib uri="/re" prefix="re" %>
  ...
  <re:doAction action="com.sssw.re.action.ReturnAsHtmlBold" id="results"/>
  ...
  The response phrase is: <%=pageContext.getAttribute("results")%>

 
Top of section

doCondition

Fires a Director condition and returns a string that represents the Boolean value returned by the condition.

This tag wraps the doCondition() method on the EbiCondition interface.

Syntax

  <prefix:doCondition condition="condition" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

condition

Yes

No

Specifies the class name for the condition that will be fired.

id

No

No

Specifies the name of the variable that will be used to store the result of the condition.

If no value is specified, the result is inserted in the page at the location where the tag appears.

Example 1

This example shows how to use the doCondition tag to insert a condition's result at the tag location:

  <% taglib uri="/re" prefix="re" %>
  ...
  Result of condition is ...
  <re:doCondition condition="com.sssw.re.condition.CheckDate" />

Example 2

This example shows how to use the doCondition tag to store an action's response phrase in a variable for further processing:

  <% taglib uri="/re" prefix="re" %>
  ...
  <re:doCondition condition="com.sssw.re.condition.CheckDate" id="result"/>
  ...
  The result is: <%=pageContext.getAttribute("result")%>

 
Top of section

conditionalRule

Fires a Director rule that returns a true or false result.

This tag wraps the isTrue() method on the EbiRuleManager interface.

Syntax

  <prefix:conditionalRule rule="rule" owner="owner" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

rule

Yes

No

Specifies the ID for the rule that will be fired.

owner

No

No

Specifies the owner for the rule.

id

No

No

Specifies the name of the variable that will be used to store the result returned by the rule.

If no value is specified, a default id of ruleResult is used.

Example

  <% taglib uri="/re" prefix="re" %>
  ...
  <re:conditionalRule rule="sample.bonus" id="rule1"/></p>
  <%=pageContext.getAttribute("rule1")%>

 
Top of section

fireRule

Fires a Director rule and returns the response phrase.

This tag wraps the fireRule() method on the EbiRuleManager interface and the getResponsePhrase() method on the EbiContext interface.

Syntax

  <prefix:fireRule rule="rule" owner="owner" id="ID" />

Attribute

Required?

Request-time expression values supported?

Description

rule

Yes

Yes

Specifies the ID for the rule that will be fired.

owner

No

No

Specifies the owner for the rule.

id

No

No

Specifies the name of the variable that will be used to store the response phrase.

If no value is specified, the response phrase is inserted in the page at the location where the tag appears.

Example 1

This example shows how to use the fireRule tag to insert a rule's response phrase at the tag location:

  <% taglib uri="/re" prefix="re" %>
  ...
  <re:fireRule rule="myrule" />

Example 2

This example shows how to use the fireRule tag to store a rule's response phrase in a variable for further processing:

  <% taglib uri="/re" prefix="re" %>
  ...
  <re:fireRule rule="myrule" id="results"/>
  ...
  The response phrase is: <%=pageContext.getAttribute("results")%>
    First Previous Next Last

Rules Guide  

Copyright © 2002, SilverStream Software, LLC, a wholly owned subsidiary of Novell, Inc. All rights reserved.