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

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
Attribute | Required | Runtime Expression Evaluation | Data Bindable
--- | --- | --- | ---
failOnError | No | No | No
A boolean that if `true` will cause the tag to fail if any errors are reported invoking the method.
method | No | No | No
Name of the method in the page flow that will be invoked.
object | Yes | No | Yes
References an object with an expression on which a choice method should be invoked.
resultId | No | No | No
The `PageContext``` attribute name where the result, if non-null, is stored.

Additional attributes can be found on the `CallMethod``` tag.

Related Topics

<netui-data:choice> Tag Sample
``Choice``
Presenting Complex Data Sets in JSPs (Repeater Tags section)

Hierarchy
  `Object`
  `TagSupport`
  `BodyTagSupport`
  `AbstractBaseTag`
  `AbstractCallMethod`
  `CallMethod`
  `ChoiceMethod`

All Implemented Interfaces
  `BodyTag`, `IterationTag`, `Serializable`, `Tag`

## Field Summary

Fields from com.bea.wlw.netui.tags`.`AbstractBaseTag``
``ATTR_GENERAL`, `ATTR_GENERAL_EXPRESSION`, `ATTR_JAVASCRIPT`, `ATTR_STYLE`, `CLASS`, `ID`, `JAVASCRIPT_STATUS`, `NAME`, `NETUI_UNIQUE_CNT`, `ONCLICK`, `ONDBLCLICK`, `ONKEYDOWN`, `ONKEYPRESS`, `ONKEYUP`, `ONMOUSEDOWN`, `ONMOUSEMOVE`, `ONMOUSEOUT`, `ONMOUSEOVER`, `ONMOUSEUP`, `STYLE`, `TABINDEX``

Fields from javax.servlet.jsp.tagext`.`BodyTagSupport``
`bodyContent`

Fields from javax.servlet.jsp.tagext`.`TagSupport``
`id, pageContext`

Fields from interface javax.servlet.jsp.tagext`.`BodyTag``
`EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

Fields from interface javax.servlet.jsp.tagext`.`IterationTag``
`EVAL_BODY_AGAIN`

Fields from interface javax.servlet.jsp.tagext`.`Tag``
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

## Constructor Summary

ChoiceMethod()

## Method Summary

`public int` | `doEndTag`() End this tag's rendering lifecycle.
`public int` | `doStartTag`() Register this tag with its `RepeaterItem``` parent.
`public `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.
`public `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.
`public void` | `setObject`(`String` object) Set the object on which the decision method should be invoked.

Methods from `com.bea.wlw.netui.tags.databinding.invoke.`CallMethod``
``findMethod`,`

Methods from `com.bea.wlw.netui.tags.databinding.invoke.`AbstractCallMethod``
``addParameter`, `findMethod`, `getFailOnError`, `getMethod`, `getObjectName`, `getParameterNodes`, `getResultId`, `localRelease`, `resolveObject`, `setFailOnError`, `setMethod`, `setResultId``

Methods from `com.bea.wlw.netui.tags.`AbstractBaseTag``
``addTagIdMapping`, `evaluateAttributeToString`, `filter`, `filter`, `getJavaScriptUtils`, `getNearestForm`, `getScriptReporter`, `getTagName`, `getUserLocale`, `localRelease`, `registerTagError`, `release`, `renderAttribute`, `rewriteName`, `write``

Methods from `javax.servlet.jsp.tagext.`BodyTagSupport``
`doAfterBody, doEndTag, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent`

Methods from `javax.servlet.jsp.tagext.`TagSupport``
`doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.servlet.jsp.tagext.`BodyTag``
`doInitBody, setBodyContent`

Methods from interface `javax.servlet.jsp.tagext.`IterationTag``
`doAfterBody`

Methods from interface `javax.servlet.jsp.tagext.`Tag``
`doEndTag, doStartTag, getParent, release, setPageContext, setParent`

## Constructor Detail

### ChoiceMethod

    public ChoiceMethod()

## Method Detail

### doEndTag() Method

    public int doEndTag()
         throws JspException

End this tag's rendering lifecycle.

Overrides
  `AbstractCallMethod.doEndTag()`

#### Returns

EVAL_PAGE

#### Exceptions

``JspException``
  if an error is reported that can not be reported in the page

### doStartTag() Method

    public int doStartTag()
         throws JspException

Register this tag with its `RepeaterItem``` parent. The `RepeaterItem``` will adjust its rendering lifecycle based on the presence of a ChoiceMethod tag.

Overrides
  `AbstractCallMethod.doStartTag()`

#### Returns

EVAL_BODY_BUFFERED; if an error occurs, return SKIP_BODY

#### Exceptions

``JspException``
  if an error is reported that can not be reported in the page

### getObject() Method

    public String getObject()

Get the expression that references an object on which to invoke the decision mtehod.

Overrides
  `CallMethod.getObject()`

#### Returns

the value of the object attribute or `null` if unset

### getObjectName() Method

    protected String getObjectName()

Get the name of the object that is the target of the invocation.

Overrides
  `CallMethod.getObjectName()`

#### Returns

a name for the object on which the method will be invoked.

### getTagName() Method

    public String getTagName()

Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Overrides
  `CallMethod.getTagName()`

#### Returns

a constant String representing the name of this tag.

### handleReturnValue(Object) Method

    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
  `AbstractCallMethod.handleReturnValue(Object)`

#### Parameters

result
  the object that resulted from invoking decision method

### localRelease() Method

    protected void localRelease()

Reset all of the fields of this tag.

Overrides
  `CallMethod.localRelease()`

### reportErrors() Method

    protected void reportErrors()
         throws JspException

Description copied from `AbstractBaseTag.reportErrors()`
This will report an expression error.

Overrides
  `AbstractBaseTag.reportErrors()`

#### Exceptions

``JspException``

### resolveObject() Method

    protected Object resolveObject()
         throws ObjectNotFoundException

Get the object on which an expression the choice method should be executed.

Overrides
  `CallMethod.resolveObject()`

#### Returns

the object on which to invoke the decision method

#### Exceptions

``ObjectNotFoundException``

### setObject(String) Method

    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
  `CallMethod.setObject(String)`

#### Parameters

object
  the object on which to invoke a method

#### Returns

the value of the object attribute or `null` if unset