BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.databinding.repeater.choice
Class ChoiceMethod

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
                  extended by com.bea.wlw.netui.tags.databinding.invoke.CallMethod
                      extended by com.bea.wlw.netui.tags.databinding.repeater.choice.ChoiceMethod
All Implemented Interfaces:
HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class ChoiceMethod
extends CallMethod

A ChoiceMethod tag is used in order to choose a particular Choice tag whose body should be rendered for the current data item in the Repeater. The ChoiceMethod tag invokes a method on an object and passes parameters from its nested MethodParameter tags. The value of each of these parameters may be taken from the "current" data item using the container.item databinding syntax. The result of evaluating this method is set on the RepeaterItem through the RepeaterItem.setChoiceValue(Object) call. The Choice tags then reach to their RepeaterItem to determine if the body of a particular Choice tag should be rendered.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
failOnErrorNoNoNo
A boolean that if true will cause the tag to fail if any errors are reported invoking the method.
methodNoNoNo
Name of the method in the page flow that will be invoked.
objectYesNoYes
References an object with an expression on which a choice method should be invoked.
resultIdNoNoNo
The PageContext attribute name where the result, if non-null, is stored.

Additional attributes can be found on the CallMethod tag.

See Also:
Choice, Serialized Form
Example:

In the following example, the <netui-data:choiceMethod> tag calls the isItemsOnSale method, which returns a boolean value. If the return value is true, then the contents of the <netui-data:choice value="true"> tag are rendered; if the return value is false, then the contents of the <netui-data:choice value="false"> tag are rendered.

          <netui-data:repeaterItem>
             <netui-data:choiceMethod object="{pageFlow}" method="isItemOnSale">
                 <netui-data:methodParameter value="{container.item.quantityavailable}"/>
             </netui-data:choiceMethod>
             <netui-data:choice value="true">
                 <tr class="row" bgcolor="#FF9999">
                     <td><netui:label value="{container.item.itemnumber}"/></td>
                     <td><netui:label value="{container.item.itemname}"/></td>
                     <td><netui:label value="{container.item.quantityavailable}"/></td>
                     <td><netui:label value="{container.item.price}"/> Clearance Item</td>
                  </tr>
             </netui-data:choice>
             <netui-data:choice value="false">
                 <tr class="row">
                     <td><netui:label value="{container.item.itemnumber}"/></td>
                     <td><netui:label value="{container.item.itemname}"/></td>
                     <td><netui:label value="{container.item.quantityavailable}"/></td>
                     <td><netui:label value="{container.item.price}"/></td>
                 </tr>
             </netui-data:choice>
          </netui-data:repeaterItem>

Sample Code

[BEA_HOME]\weblogic81\samples\workshop\SamplesApp\WebApp\tagSamples\netui_databinding\choice

Beadoc.see:
<netui-data:choice> Tag Sample, Presenting Complex Data Sets in JSPs (Repeater Tags section)
Beadoc.tagdescription:
The <netui-data:choiceMethod> tag invokes a decision method on the basis of which a particular Choice tag is rendered. The <netui-data:choiceMethod> tag makes its decision by invoking a method on an object. (Parameters are passed to the method from nested MethodParameter tags. The value of each of these parameters may be taken from the "current" data item using the expression {container.item...}.)

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
AbstractCallMethod.ParamNode
 
Field Summary
 
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ChoiceMethod()
           
 
Method Summary
 int doEndTag()
          End this tag's rendering lifecycle.
 int doStartTag()
          Register this tag with its RepeaterItem parent.
 String getObject()
          Get the expression that references an object on which to invoke the decision mtehod.
protected  String getObjectName()
          Get the name of the object that is the target of the invocation.
 String getTagName()
          Get the name of this tag.
protected  void handleReturnValue(Object result)
          Handle any value that may be returned from the decision method.
protected  void localRelease()
          Reset all of the fields of this tag.
protected  void reportErrors()
          This will report an expression error.
protected  Object resolveObject()
          Get the object on which an expression the choice method should be executed.
 void setObject(String object)
          Set the object on which the decision method should be invoked.
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.invoke.CallMethod
findMethod
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
addParameter, getFailOnError, getMethod, getParameterNodes, getResultId, setFailOnError, setMethod, setResultId
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Constructor Detail

ChoiceMethod

public ChoiceMethod()
Method Detail

getTagName

public String getTagName()
Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Overrides:
getTagName in class CallMethod
Returns:
a constant String representing the name of this tag.

setObject

public void setObject(String object)
Set the object on which the decision method should be invoked. The value of this attribute should be an expression

Overrides:
setObject in class CallMethod
Parameters:
object - the object on which to invoke a method
Beadoc.attributedescription:
The object which contains the method to invoke.
Beadoc.attributesyntaxvalue:
string_object
Beadoc.databindable:
true

getObject

public String getObject()
Get the expression that references an object on which to invoke the decision mtehod.

Overrides:
getObject in class CallMethod
Returns:
the value of the object attribute or null if unset

localRelease

protected void localRelease()
Reset all of the fields of this tag.

Overrides:
localRelease in class CallMethod

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Register this tag with its RepeaterItem parent. The RepeaterItem will adjust its rendering lifecycle based on the presence of a ChoiceMethod tag.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class AbstractCallMethod
Returns:
EVAL_BODY_BUFFERED; if an error occurs, return SKIP_BODY
Throws:
javax.servlet.jsp.JspException - if an error is reported that can not be reported in the page
See Also:
MethodParameter

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
End this tag's rendering lifecycle.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class AbstractCallMethod
Returns:
EVAL_PAGE
Throws:
javax.servlet.jsp.JspException - if an error is reported that can not be reported in the page
See Also:
AbstractCallMethod.getMethod(), AbstractCallMethod.handleReturnValue(java.lang.Object), MethodParameter, ObjectNotFoundException, TypeUtils.convertToObject(java.lang.String, java.lang.Class), String

resolveObject

protected Object resolveObject()
                        throws ObjectNotFoundException
Get the object on which an expression the choice method should be executed.

Overrides:
resolveObject in class CallMethod
Returns:
the object on which to invoke the decision method
Throws:
ObjectNotFoundException

handleReturnValue

protected void handleReturnValue(Object result)
Handle any value that may be returned from the decision method. The result of invoking the decision method is set on the RepeaterItem so that it can be accessed by the Choice tags in a repeater tag's RepeaterItem tag.

Overrides:
handleReturnValue in class AbstractCallMethod
Parameters:
result - the object that resulted from invoking decision method

getObjectName

protected String getObjectName()
Get the name of the object that is the target of the invocation.

Overrides:
getObjectName in class CallMethod
Returns:
a name for the object on which the method will be invoked.

reportErrors

protected void reportErrors()
                     throws javax.servlet.jsp.JspException
Description copied from class: AbstractBaseTag
This will report an expression error.

Overrides:
reportErrors in class AbstractBaseTag
Throws:
javax.servlet.jsp.JspException

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.