org.apache.beehive.netui.tags.html
Class CheckBox
Object
TagSupport
BodyTagSupport
AbstractClassicTag
HtmlBaseTag
HtmlFocusBaseTag
HtmlDataSourceTag
HtmlDefaultableDataSourceTag
CheckBox
- All Implemented Interfaces:
- Serializable, BodyTag, IterationTag, JspTag, Tag, HtmlConstants, IAttributeConsumer, IHtmlAccessable, IHtmlAttrs, IHtmlCore, IHtmlEvents, IHtmlI18n, INetuiTag
public class CheckBox
- extends HtmlDefaultableDataSourceTag
- implements IHtmlAccessable
Generates a checkbox which binds to a form bean property or databound expression.
CheckBox should be used on its own and not within a CheckBoxGroup. CheckBox ignores its
body content.
CheckBoxes can bind to boolean, Boolean, and Strings.
- See Also:
- Serialized Form
- Example
- In this sample, the <netui:checkBox reads it initial value from the
Form Bean field
wantSpecialOffers
. Upon submission, the user specified value is
loaded into the same Form Bean field. The data is submitted to the
action method processData
.
<netui:form action="processData">
Do you want to be notified of special offers?
<netui:checkBox dataSource="{actionForm.wantsSpecialOffers}"/><br>
<netui:button value="Submit" type="submit"/>
</netui:form>
Fields inherited from class BodyTagSupport |
bodyContent |
Fields inherited from class TagSupport |
id, pageContext |
Fields inherited from interface 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 BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface IterationTag |
EVAL_BODY_AGAIN |
Fields inherited from interface Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Method Summary |
int |
doAfterBody()
Save the body content of the checkbox. |
int |
doEndTag()
Render the checkbox. |
int |
doStartTag()
Render the checkbox. |
protected List |
getNamingChain()
Return an ArrayList which represents a chain of NameInterceptor
objects. |
protected AbstractHtmlState |
getState()
This method will return the state associated with the tag. |
String |
getTagName()
Return the name of the Tag. |
protected void |
localRelease()
Release any acquired resources. |
void |
setAccessKey(char accessKey)
Sets the accessKey attribute value. |
void |
setAlt(String alt)
Sets the alt attribute value. |
void |
setAttribute(String name,
String value,
String facet)
Base support for the attribute tag. |
void |
setTabindex(int tabindex)
Sets the tabIndex of the rendered html tag. |
Methods inherited from class HtmlBaseTag |
addTagIdMapping, getJavaScriptAttribute, getNearestForm, getNearestIdWriter, getOnClick, getTagId, isIdTransparency, qualifyUrlToContext, renderTagId, setDir, setLang, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStateAttribute, setStyle, setStyleClass, setTagId, setTitle |
Methods inherited from class AbstractClassicTag |
applyNamingChain, getErrorsReport, getNextId, getScriptReporter, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, renderAttribute, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write |
Methods inherited from class BodyTagSupport |
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface Tag |
getParent, setPageContext, setParent |
CheckBox
public CheckBox()
getTagName
public String getTagName()
- Return the name of the Tag.
- Specified by:
getTagName
in interface INetuiTag
- Specified by:
getTagName
in class AbstractClassicTag
- Returns:
- the name of the tag.
setAttribute
public void setAttribute(String name,
String value,
String facet)
throws JspException
- Base support for the attribute tag. This is overridden to prevent setting the
type
,
checked
and value
attributes.
- Specified by:
setAttribute
in interface IAttributeConsumer
- Overrides:
setAttribute
in class HtmlBaseTag
- Parameters:
name
- The name of the attribute. This value may not be null or the empty string.value
- The value of the attribute. This may contain an expression.facet
- The name of a facet to which the attribute will be applied. This is optional.
- Throws:
JspException
- A JspException may be thrown if there is an error setting the attribute.
getState
protected AbstractHtmlState getState()
- This method will return the state associated with the tag. This is used by this
base class to access the individual state objects created by the tags.
- Specified by:
getState
in class HtmlBaseTag
- Returns:
- a subclass of the
AbstractHtmlState
class.
getNamingChain
protected List getNamingChain()
- Return an
ArrayList
which represents a chain of NameInterceptor
objects. This method by default returns null
and should be overridden
by objects that support naming.
- Overrides:
getNamingChain
in class HtmlDataSourceTag
- Returns:
- an
ArrayList
that will contain NameInterceptor
objects.
doStartTag
public int doStartTag()
throws JspException
- Render the checkbox.
- Specified by:
doStartTag
in interface Tag
- Overrides:
doStartTag
in class BodyTagSupport
- Throws:
JspException
- if a JSP exception has occurred
doAfterBody
public int doAfterBody()
throws JspException
- Save the body content of the checkbox.
- Specified by:
doAfterBody
in interface IterationTag
- Overrides:
doAfterBody
in class BodyTagSupport
- Throws:
JspException
- if a JSP exception has occurred
doEndTag
public int doEndTag()
throws JspException
- Render the checkbox.
- Specified by:
doEndTag
in interface Tag
- Overrides:
doEndTag
in class BodyTagSupport
- Throws:
JspException
- if a JSP exception has occurred
localRelease
protected void localRelease()
- Release any acquired resources.
- Overrides:
localRelease
in class HtmlDefaultableDataSourceTag
setAccessKey
public void setAccessKey(char accessKey)
- Sets the accessKey attribute value. This should key value of the
keyboard navigation key. It is recommended not to use the following
values because there are often used by browsers
A, C, E, F, G,
H, V, left arrow, and right arrow
.
- Specified by:
setAccessKey
in interface IHtmlAccessable
- Parameters:
accessKey
- - the accessKey value.
setAlt
public void setAlt(String alt)
- Sets the alt attribute value.
- Specified by:
setAlt
in interface IHtmlAccessable
- Parameters:
alt
- - the alt value.
setTabindex
public void setTabindex(int tabindex)
- Sets the tabIndex of the rendered html tag.
- Parameters:
tabindex
- - the tab index.