com.opensymphony.webwork.components
Class CheckboxList
java.lang.Object
com.opensymphony.webwork.components.Component
com.opensymphony.webwork.components.UIBean
com.opensymphony.webwork.components.ListUIBean
com.opensymphony.webwork.components.CheckboxList
public class CheckboxList
- extends ListUIBean
Creates a series of checkboxes from a list. Setup is like <ww:select /> or <ww:radio />, but creates checkbox tags.
Examples
<ww:checkboxlist name="foo" list="bar"/>
It is possible to select multiple checkboxes, by handling a List into the value attribute.
The List passed into the value attribute could be :-
- key if the list attribute is passed in is a Map
- listKey properties if listKey attribute is used
- entry/entries passed into the list attribute
<ww:checkboxlist name="options"
list="%{#{'FOO':'foo','BAR':'bar','BAZ':'baz','BOO':'boo'}}"
value="%{{'FOO','BAZ'}}" />
<ww:checkboxlist name="options"
list="%{{'Foo','Bar','Baz'}}"
value="%{{'Foo','Bar'}}" />
public class MyAction extends ActionSupport {
public List<Choice> getChoices() {
....
}
....
public List<String> getPreSelectedChoices() {
// returns a list of Choice.getKey(), which is a String
....
}
}
public class Choice {
public String getKey() { ...}
public String getDisplayName() { ... }
....
}
<ww:checkboxlist name="myChoice"
list="%{choices}"
listKey="%{'key'}"
listValue="%{'displayName'}"
value="%{preSelectedChoices}" />
- Since:
- 2.2
- Version:
- $Revision: 2746 $
- Author:
- Patrick Lightbody, Rene Gielen
Fields inherited from class com.opensymphony.webwork.components.UIBean |
accesskey, cssClass, cssStyle, disabled, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateSuffix, theme, title, tooltip, tooltipConfig, value |
Method Summary |
protected String |
getDefaultTemplate()
A contract that requires each concrete UI Tag to specify which template should be used as a default. |
Methods inherited from class com.opensymphony.webwork.components.UIBean |
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateNameValue, evaluateParams, getTemplate, getTemplateDir, getTheme, getTooltipConfig, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDisabled, setLabel, setLabelposition, setLabelPosition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTheme, setTitle, setTooltip, setTooltipConfig, setValue |
Methods inherited from class com.opensymphony.webwork.components.Component |
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setId, start, toString, usesBody |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEMPLATE
public static final String TEMPLATE
- See Also:
- Constant Field Values
CheckboxList
public CheckboxList(OgnlValueStack stack,
HttpServletRequest request,
HttpServletResponse response)
getDefaultTemplate
protected String getDefaultTemplate()
- Description copied from class:
UIBean
- A contract that requires each concrete UI Tag to specify which template should be used as a default. For
example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value
not begin with a '/' unless you intend to make the path absolute rather than relative to the
current theme.
- Specified by:
getDefaultTemplate
in class UIBean
- Returns:
- The name of the template to be used as the default.