Class CheckTag
java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
org.deltava.taglib.BrowserInfoTag
org.deltava.taglib.html.ElementTag
org.deltava.taglib.html.FormElementTag
org.deltava.taglib.html.CheckTag
- All Implemented Interfaces:
jakarta.servlet.jsp.tagext.IterationTag, jakarta.servlet.jsp.tagext.JspTag, jakarta.servlet.jsp.tagext.Tag, Serializable
A JSP tag to support the generation of HTML multi-option checkboxes and radio buttons.
- Since:
- 1.0
- Version:
- 12.3
- Author:
- Luke
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ObjectAn additional entry prepended to the list of optionsFields inherited from class FormElementTag
_valueFields inherited from class ElementTag
_classes, _data, _outModifier and TypeFieldDescriptionprotected final Collection<String> protected final XMLRendererprotected jakarta.servlet.jsp.JspWriterFields inherited from class jakarta.servlet.jsp.tagext.TagSupport
id, pageContextFields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoEndTag()Renders the checkbox tags.voidrelease()Releases the tag's state data.voidsetChecked(Collection<Object> values) Sets the selected value(s) of this element.final voidsetClassName(String cName) Sets the CSS class name for the checkbox/radio text .voidsetCols(int columns) Sets the width of the field in columns; afterwards the separator will be outputted.voidsetFirstEntry(Object entry) Allows an entry to be inserted before the rest of the options.voidSets the check box name, saving for the CSS class.voidsetNewLine(boolean doNewLine) Sets the multiple element separator to a DIV with a new line.voidsetOnChange(String jsEvent) Sets the JavaScript onChange event for these checkboxes/radio buttons.voidsetOptions(Collection<?> choices) Sets the choices for this checkbox/radio button.voidsetSeparator(String sep) Sets the multiple element separator.voidSets the element type.voidsetWidth(int width) Sets the width of each checkbox entry.Methods inherited from class FormElementTag
setDelimValues, setIdx, setRequired, setValue, validateStateModifier and TypeMethodDescriptionvoidsetDelimValues(String values) Sets multiple values for this input element.voidSets the tab index of this field.voidsetRequired(boolean isRequired) Sets this field as required for HTML5 browsers.voidSets the value of this input element.protected voidValidates tag state.Methods inherited from class ElementTag
doStartTag, getFormIndexCount, getName, getParentFormTag, setID, setNumericAttr, setPageContext, setStyleModifier and TypeMethodDescriptionintprotected intGets and increments the current tab index count for the parent form tag.protected StringgetName()Returns the type of HTML element this tag generated.protected FormTagReturns the parent form tag.voidSets the ID of this HTML element.protected voidsetNumericAttr(String attrName, int value, int minValue) Sets a numeric attribute.voidsetPageContext(jakarta.servlet.jsp.PageContext ctxt) voidAssociates a CSS style with this HTML element.Methods inherited from class BrowserInfoTag
getBrowserContext, passedCAPTCHAModifier and TypeMethodDescriptionprotected HTTPContextDataFetches the browser data.protected booleanReturns whether the user has passed CAPTCHA validation.Methods inherited from class jakarta.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
-
Field Details
-
_firstEntry
An additional entry prepended to the list of options
-
-
Constructor Details
-
CheckTag
public CheckTag()Creates a new checkbox/radio tag.
-
-
Method Details
-
setCols
public void setCols(int columns) Sets the width of the field in columns; afterwards the separator will be outputted.- Parameters:
columns- the number of columns
-
setWidth
public void setWidth(int width) Sets the width of each checkbox entry.- Parameters:
width- the width in pixels
-
setName
Sets the check box name, saving for the CSS class.- Overrides:
setNamein classFormElementTag- Parameters:
name- the field name
-
setFirstEntry
Allows an entry to be inserted before the rest of the options.- Parameters:
entry- the first entry to insert
-
setOnChange
Sets the JavaScript onChange event for these checkboxes/radio buttons.- Parameters:
jsEvent- the JavaScript event code
-
doEndTag
public int doEndTag() throws jakarta.servlet.jsp.JspExceptionRenders the checkbox tags.- Specified by:
doEndTagin interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjakarta.servlet.jsp.tagext.TagSupport- Returns:
- EVAL_PAGE always
- Throws:
jakarta.servlet.jsp.JspException- if an error occurs
-
release
public void release()Releases the tag's state data.- Specified by:
releasein interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
releasein classElementTag
-
setClassName
Sets the CSS class name for the checkbox/radio text .- Overrides:
setClassNamein classElementTag- Parameters:
cName- the CSS class name(s)- See Also:
-
setType
Sets the element type. Updats the default CSS class to "check" or "radio".- Parameters:
checkType- the element type, typically RADIO or CHECKBOX
-
setSeparator
Sets the multiple element separator.- Parameters:
sep- the string to insert between multiple elements- See Also:
-
setNewLine
public void setNewLine(boolean doNewLine) Sets the multiple element separator to a DIV with a new line.- Parameters:
doNewLine- TRUE if the separator should be set, otherwise FALSE- See Also:
-
setChecked
Sets the selected value(s) of this element.- Parameters:
values- a List of selected values of this element
-
setOptions
Sets the choices for this checkbox/radio button.- Parameters:
choices- a Collection of choices
-