|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport javax.servlet.jsp.tagext.BodyTagSupport com.bea.wlw.netui.tags.AbstractBaseTag com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag com.bea.wlw.netui.tags.databinding.repeater.RepeaterComponent com.bea.wlw.netui.tags.databinding.repeater.choice.Choice
public class Choice
A tag that when nested in a RepeaterItem
allows its body to be rendered
conditionally. The Choice tag must be used together with the ChoiceMethod
tag in order to achieve conditional rendering of the body of a particular
Choice tag. A single ChoiceMethod
and one or more Choice tags should be
nested within a RepeaterItem
. The RepeaterItem
then uses the ChoiceMethod
to invoke a decision method that returns the value. The return value is then compared
against the value
attribute on each Choice tag in order to select the
Choice whose body should be rendered. If no match is found but one of the
Choice tags has its default
attribute set, this "default"
Choice will be rendered.
Attribute Descriptions | |||
---|---|---|---|
Attribute | Required | Runtime Expression Evaluation | Data Bindable |
default | No | No | No |
A boolean that if true will render this Choice's body if no Choice's value matches the result of the ChoiceMethod . | |||
value | No | No | Yes |
A String value that will be matched against the value returned from invoking the ChoiceMethod . |
ChoiceMethod
,
Serialized FormIn 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>
[BEA_HOME]\weblogic81\samples\workshop\SamplesApp\WebApp\tagSamples\netui_databinding\choice
ChoiceMethod
tag.
The <netui-data:choice> tag must be used together with the <netui-data:choiceMethod>
tag in order to achieve conditional rendering of the body of a particular
<netui-data:choice> tag. A single <netui-data:choiceMethod> and one or more
<netui-data:choice> tags should be
nested within a RepeaterItem
tag.
<netui-data:repeaterItem> <netui-data:choiceMethod object="{pageFlow}" method="myChoiceMethod"/> <netui-data:choice value="case1"> <!-- Content to render if myChoiceMethod returns "case1" --> </netui-data:choice> <netui-data:choice value="case2"> <!-- Content to render if myChoiceMethod returns "case2" --> </netui-data:choice> <netui-data:choice value="default"> <!-- Content to render if myChoiceMethod neither "case1" nor "case2". --> </netui-data:choice> </netui-data:repeaterItem>For each item in the <netui-data:repeaterItem> tag's data set, the <netui-data:choiceMethod> invokes a decision method that returns a value. The return value is then compared against the
value
attribute on each <netui-data:choice> tag in order to select the
<netui-data:choice> whose body should be rendered. If no match is found but one of the
<netui-data:choice> tags has its default
attribute set to true, this "default"
<netui-data:choice> will be rendered.Field Summary |
---|
Fields inherited from class com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag |
---|
EMPTY_STRING |
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 | |
---|---|
Choice()
|
Method Summary | |
---|---|
int |
doAfterBody()
Handle the content that may have been rendered in the body by adding it to the RepeaterItem 's content. |
Object |
getActualValue()
|
protected int |
getCurrentRenderState()
Get the current render state of this tag's RepeaterItem parent. |
boolean |
getDefault()
Get the boolean value of the default attribute. |
String |
getTagName()
Get the name of this tag. |
protected Class |
getValidContainerType()
Get the valid container type of this tag, the RepeaterItem . |
String |
getValue()
Get the String value that will be checked for a match in the ChoiceMethod . |
protected void |
localRelease()
Reset all of the fields of this tag. |
protected void |
prepare()
Prepare data that is provided to subclasses of this tag. |
int |
renderStartTag(int state)
Conditionally render the body of this tag. |
protected void |
reportErrors()
This will report an expression error. |
void |
setDefault(boolean defaultItem)
Sets a boolean value that, if true will mark a Choice tag as
the "default" Choice if no other Choices match the value returned in
invoking the ChoiceMethod. |
void |
setValue(String value)
Set a String value that is used by the RepeaterItem to select this Choice
tag if this value is returned by the ChoiceMethod . |
String |
toString()
Get a debugging String that represents a PadContext. |
Methods inherited from class com.bea.wlw.netui.tags.databinding.repeater.RepeaterComponent |
---|
getRepeater, renderEndTag |
Methods inherited from class com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag |
---|
addContent, doEndTag, doStartTag, getContent, verifyAttributes, verifyStructure |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
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, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
---|
getParent, setParent |
Constructor Detail |
---|
public Choice()
Method Detail |
---|
public String getTagName()
getTagName
in class AbstractBaseTag
public void setDefault(boolean defaultItem)
true
will mark a Choice tag as
the "default" Choice if no other Choices match the value returned in
invoking the ChoiceMethod.
defaultItem
- a boolean that denotes this item as the "default" to renderpublic boolean getDefault()
true
if this Choice tag is the default choice in a
Repeater body; false
otherwisepublic void setValue(String value)
RepeaterItem
to select this Choice
tag if this value is returned by the ChoiceMethod
. The RepeaterItem
selects a Choice based on the value returned by running the ChoiceMethod
tag; this value is compared against the value
attribute here. If
a match is found in performing this comparison, the matching Choice tag is
rendered in the RepeaterItem
.
value
- the value that should be matched in order to render this Choicepublic String getValue()
ChoiceMethod
.
null
if unsetpublic Object getActualValue()
public int renderStartTag(int state) throws javax.servlet.jsp.JspException
RepeaterItem.shouldRender(Object, boolean)
call returns true and the RepeaterItem
is in its RepeaterItem.RENDER
state. Otherwise,
the body is skipped.
renderStartTag
in class StructuredBaseTag
state
- the Repeater
tag's current render state
javax.servlet.jsp.JspException
protected void reportErrors() throws javax.servlet.jsp.JspException
AbstractBaseTag
reportErrors
in class AbstractBaseTag
javax.servlet.jsp.JspException
public int doAfterBody()
RepeaterItem
's content.
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
in class RepeaterComponent
protected void localRelease()
localRelease
in class RepeaterComponent
public String toString()
toString
in class Object
protected int getCurrentRenderState()
RepeaterItem
parent.
getCurrentRenderState
in class RepeaterComponent
RepeaterItem
protected Class getValidContainerType()
RepeaterItem
.
getValidContainerType
in class RepeaterComponent
protected void prepare()
prepare
in class RepeaterComponent
|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |