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.html
Class RadioButtonGroup

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.DataSourceTag
                  extended by com.bea.wlw.netui.tags.DefaultableDataSourceTag
                      extended by com.bea.wlw.netui.tags.OptionsDataSourceTag
                          extended by com.bea.wlw.netui.tags.html.RadioButtonGroup
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 RadioButtonGroup
extends OptionsDataSourceTag

Groups a collection of RadioButtonOptions, and handles databinding of their values. If RadioButtonGroup uses any Format tags, it must have those tags come before above any nested RadioButtonOption tags.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
dataSourceYesNoRead / Write
The name of a form bean property or an expression that contains the RadioButtonGroup state
defaultValueNoNoRead Only
A literal value or an expression that is used to set the RadioButtonGroup's initial state
disabledNoNoRead Only
A boolean value which if true will cause the RadioButtonGroup to be disabled.
labelStyleNoNoNo
The style of the label for each contained RadioButtonOption
labelStyleClassNoNoNo
The style class of the label for each contained RadioButtonOption
optionsDataSourceNoNoRead Only
An expression which is used to generate a set of dynamic RadioButtonOptions
tagIdNoNoNo
The ID of this radioButtonGroup used by the enclosing html tag to get the tag's name for javascript purposes

See Also:
RadioButtonOption, Serialized Form
Example:
In this sample, a <netui:radioButtonGroup> tag draws a set of options from a HashMap object.
         <netui:radioButtonGroup
          optionsDataSource="{pageFlow.hashMap}"
          dataSource="{actionForm.selection}" />
Assuming that the optionsDataSource attribute refers to the following HashMap object...
     public HashMap hashMap = new HashMap();
     protected void onCreate()
     {
         hashMap.put("value1", "Display Text 1");
         hashMap.put("value2", "Display Text 2");
         hashMap.put("value3", "Display Text 3");
     }
...then the following HTML will be generated in the browser...
     <netui:radioButtonGroup dataSource="{actionForm.selection}">
        <netui:radioButtonOption value="value1">Display Text 1</netui:radioButtonOption><br>
        <netui:radioButtonOption value="value2">Display Text 2</netui:radioButtonOption><br>
        <netui:radioButtonOption value="value3">Display Text 3</netui:radioButtonOption><br>
    </netui:radioButtonGroup>

Sample Code

[BEA_HOME]/weblogic81/samples/SamplesApp/WebApp/tagSamples/netui/radioButtons/

Beadoc.see:
<netui:radionButton> Tag Samples
Beadoc.tagdescription:
Renders a collection of radiobutton options and handles the data binding of their values.

The <netui:radioButtonGroup> tag can generate a set of radiobutton options in two ways:

  1. they can be dynamically generated by pointing the <netui:radioButtonGroup> tag at a java.util.HashMap or String[] object
  2. they can be statically generated by providing a set of children RadioButtonOption tags

Dynamically Generated Radiobutton Options

You can dynamically generate a set of radionbutton options by pointing the <netui:radioButtonGroup> tag at a HashMap (or any object that implements the java.util.Map interface).

      public HashMap hashMap = new HashMap();
      hashMap.put("value1", "Display Text 1");
      hashMap.put("value2", "Display Text 2");
      hashMap.put("value3", "Display Text 3");

To point the <netui:radioButtonGroup> at the Map object use the optionsDataSource attribute.

     <netui:radioButtonGroup
          optionsDataSource="{pageFlow.hashMap}">

In the generated radiobutton options, the display text and the submitted value can be made to differ. The HashMap keys will form the submitted values, while the HashMap entries will form the display texts.

     <input type="radio" value="value1">Display Text 1</input>
     <input type="radio" value="value2">Display Text 2</input>
     <input type="radio" value="value3">Display Text 3</input>

Note that you can point the <netui:radioButtonGroup> tag at a String[] object. A set of radiobutton options will be generated, but there will be no difference between the display texts and the submitted values.

Statically Generated Radiobutton Options

To statically generate radiobutton options, place a set of <netui:radioButtonOption> tags inside the <netui:radioButtonGroup> tag.

    <netui:radioButtonGroup dataSource="{actionForm.selection}">
        <netui:radioButtonOption value="value1">Display Text 1</netui:radioButtonOption><br>
        <netui:radioButtonOption value="value2">Display Text 2</netui:radioButtonOption><br>
        <netui:radioButtonOption value="value3">Display Text 3</netui:radioButtonOption><br>
    </netui:radioButtonGroup>

Submitting Radionbutton Options

A <netui:radioButtonGroup> is submitted as a String value. Use the dataSource attribute to submit to a String object.

     <netui:radioButtonGroup dataSource="{actionForm.selection}">

In this case, the <netui:radioButtonGroup> submits to a String field of a Form Bean.

     public static class ProcessDataForm extends FormData
     {
         private String selection;
      
         public void setSelection(String selection)
         {
             this.selection = selection;
         }

         public String getSelection()
         {
             return this.selection;
         }
     }

Nested Class Summary
static class RadioButtonGroup.RadioButtonGroupPrefixHandler
          The handler for naming and indexing the RadioButtonGroup.
 
Field Summary
protected  String defaultRadio
           
protected  String labelStyle
           
protected  String labelStyleClass
           
protected  String match
          The actual values we will match against, calculated in doStartTag().
static String RADIOBUTTONGROUP_KEY
           
protected  String saveBody
          The saved body content of this tag.
 
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
RadioButtonGroup()
           
 
Method Summary
 int doAfterBody()
          Save the body content of the RadioButtonGroup.
 int doEndTag()
          Render the set of RadioButtonOptions.
 int doStartTag()
          Determine the match for the RadioButtonGroup
protected  Object evaluateDefaultValue()
           
protected  Object evaluateOptionsDataSource()
          This method will evalute the optionsDataSource and return an object.
 String getDisabled()
          Returns the boolean value or expression indicating the disable state of the RadioButtonGroup.
 String getLabelStyle()
          Return the label style for each contained CheckBoxOption..
 String getLabelStyleClass()
          Return the label style class for each contained CheckBoxOption..
 String getStyle()
          Gets the style of the rendered html tag.
 String getStyleClass()
          Gets the style class of the rendered html tag.
 String getTagId()
          Return the ID of the radiobutton group.
 String getTagName()
          Return the name of the Tag.
 boolean isMatched(String value)
          Does the specified value match one of those we are looking for?
protected  void localRelease()
          Release any acquired resources.
 String qualifyDataSource()
           
 void setDisabled(String disabled)
          Set the disable state either with the literal "true" or "false" or with an expression.
 void setLabelStyle(String labelStyle)
          Set the label style for each contained CheckBoxOption..
 void setLabelStyleClass(String labelStyleClass)
          Set the label style class for each contained CheckBoxOption..
 void setStyle(String style)
          Sets the style of the rendered html tag.
 void setStyleClass(String styleClass)
          Sets the style class of the rendered html tag.
 void setTagId(String tagId)
          Set the ID of the radiobutton group.
 
Methods inherited from class com.bea.wlw.netui.tags.OptionsDataSourceTag
getOptionsDataSource, setOptionsDataSource
 
Methods inherited from class com.bea.wlw.netui.tags.DefaultableDataSourceTag
getDefaultValue, setDefaultValue
 
Methods inherited from class com.bea.wlw.netui.tags.DataSourceTag
addNamingInterceptor, doNaming, evaluateDataSource, getDataSource, qualifyAttribute, removeNamingInterceptor, setDataSource
 
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, reportErrors, rewriteName, setPageContext, updateExpression, write
 
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, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

RADIOBUTTONGROUP_KEY

public static final String RADIOBUTTONGROUP_KEY
See Also:
Constant Field Values

match

protected String match
The actual values we will match against, calculated in doStartTag().


saveBody

protected String saveBody
The saved body content of this tag.


defaultRadio

protected String defaultRadio

labelStyle

protected String labelStyle

labelStyleClass

protected String labelStyleClass
Constructor Detail

RadioButtonGroup

public RadioButtonGroup()
Method Detail

getTagName

public String getTagName()
Return the name of the Tag.

Specified by:
getTagName in class AbstractBaseTag

evaluateDefaultValue

protected Object evaluateDefaultValue()
Overrides:
evaluateDefaultValue in class DefaultableDataSourceTag
Exclude:

evaluateOptionsDataSource

protected Object evaluateOptionsDataSource()
                                    throws javax.servlet.jsp.JspException
This method will evalute the optionsDataSource and return an object. If the object return from evaluating the expression results in a Map that is returned. Otherwise we will return an iterator. This routine will always return either a valid Iterator or Map.

Overrides:
evaluateOptionsDataSource in class OptionsDataSourceTag
Throws:
javax.servlet.jsp.JspException

getLabelStyle

public String getLabelStyle()
Return the label style for each contained CheckBoxOption..

Returns:
the label style

setLabelStyle

public void setLabelStyle(String labelStyle)
Set the label style for each contained CheckBoxOption..

Parameters:
labelStyle - - the label style
Beadoc.attributedescription:
The style of the label for each contained <netui:radioButtonOption> tag.
Beadoc.attributesyntaxvalue:
string_labelStyle
Beadoc.databindable:
false

getLabelStyleClass

public String getLabelStyleClass()
Return the label style class for each contained CheckBoxOption..

Returns:
the label style

setLabelStyleClass

public void setLabelStyleClass(String labelStyleClass)
Set the label style class for each contained CheckBoxOption..

Parameters:
labelStyleClass - - the label style
Beadoc.attributedescription:
The class of the labels for each contained <netui:radioButtonOption> tag.
Beadoc.attributesyntaxvalue:
string_class
Beadoc.databindable:
false

setStyle

public void setStyle(String style)
Sets the style of the rendered html tag.

Parameters:
style - - the html style.
Beadoc.attributedescription:
Sets the style of the rendered HTML tag.
Beadoc.attributesyntaxvalue:
string_Style
Beadoc.databindable:
false

getStyle

public String getStyle()
Gets the style of the rendered html tag.

Returns:
the style.

setStyleClass

public void setStyleClass(String styleClass)
Sets the style class of the rendered html tag.

Parameters:
styleClass - - the html style class.
Beadoc.attributedescription:
The class of the rendered HTML tag.
Beadoc.attributesyntaxvalue:
string_Class
Beadoc.databindable:
false

getStyleClass

public String getStyleClass()
Gets the style class of the rendered html tag.

Returns:
the style class.

getTagId

public String getTagId()
Return the ID of the radiobutton group.

Returns:
the ID.

setTagId

public void setTagId(String tagId)
Set the ID of the radiobutton group.

Parameters:
tagId - - the ID.
Beadoc.attributedescription:

String value. Sets the id (or name) attribute of the rendered HTML tag. Note that the real id attribute rendered in the browser may be changed by the application container (for example, Portal containers may change the rendered id value to ensure the uniqueness of id's on the page). In this case, the real id rendered in the browser may be looked up through the JavaScript function getNetuiTagName( tagId, tag ).

For example, assume that some tag's tagId attribute is set to foo.

    <netui:textBox tagId="foo" />

Then the following JavaScript function will return the real id attribute rendered in the browser:

    getNetuiTagName( "foo", this )

To get a <netui:form> element and all of its children elements in JavaScript, use the same JavaScript function getNetuiTagName( tagId, tag ). For example, assume that there is a <netui:form> whose tagId attribute is set to bar.

    <netui:form tagId="bar" >

Then the following JavaScript function will return the <netui:form> element and its children (packaged as an array).

    document[getNetuiTagName( "bar", this )]

To retreive the value entered into a <netui:textBox> within the <netui:form> tag, use the following JavaScript expression.

    document[getNetuiTagName("bar", this)][getNetuiTagName("foo", this)].value

The second parameter ensures that the JavaScript function begins its search within the correct Portlet scope. Pass the JavaScript keyword this as the second parameter. For detailed information on using the function getNetuiTagName( tagId, tag ) see Using JavaScript in Page Flow and Portal Applications.

Beadoc.attributesyntaxvalue:
string_tagId
Beadoc.databindable:
false

getDisabled

public String getDisabled()
Returns the boolean value or expression indicating the disable state of the RadioButtonGroup.

Returns:
the disabled state (true or false) or an expression

setDisabled

public void setDisabled(String disabled)
Set the disable state either with the literal "true" or "false" or with an expression.

Parameters:
disabled - - true or false or an expression
Beadoc.attributedescription:
Boolean. If set to true, the group will be visible, but diabled.
Beadoc.attributesyntaxvalue:
boolean_disabled
Beadoc.databindable:
Read Only

isMatched

public boolean isMatched(String value)
Does the specified value match one of those we are looking for?

Parameters:
value - Value to be compared
Exclude:

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Determine the match for the RadioButtonGroup

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Save the body content of the RadioButtonGroup.

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Render the set of RadioButtonOptions.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

localRelease

protected void localRelease()
Release any acquired resources.

Overrides:
localRelease in class OptionsDataSourceTag

qualifyDataSource

public String qualifyDataSource()
                         throws javax.servlet.jsp.JspException
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.