From a5446be3bbf07a18bc6fbc4d07dc47c263887d52 Mon Sep 17 00:00:00 2001 From: Calvin Date: Sat, 1 Sep 2012 01:25:05 +0800 Subject: [PATCH] =?UTF-8?q?#85=20spring=20mvc=20taglib=E7=9A=84checkbox,?= =?UTF-8?q?=20radio=20=E6=94=AF=E6=8C=81twitter=20bootstrap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/account/ShiroDbRealm.java | 19 +- .../functional/QuickStartServer.java | 3 +- .../showcase/service/ShiroDbRealm.java | 29 +- .../examples/showcase/web/UserController.java | 13 +- .../main/webapp/WEB-INF/springside-form.tld | 2599 +++++++++++++++++ .../webapp/WEB-INF/views/account/userForm.jsp | 4 +- modules/core/pom.xml | 9 + .../BSAbstractMultiCheckedElementTag.java | 125 + .../modules/web/taglib/BSRadioButtonsTag.java | 8 + .../resources/META-INF/springside-form.tld | 2599 +++++++++++++++++ .../resources/META-INF/springside-shiro.tld | 2 +- 11 files changed, 5384 insertions(+), 26 deletions(-) create mode 100644 examples/showcase/src/main/webapp/WEB-INF/springside-form.tld create mode 100644 modules/core/src/main/java/org/springside/modules/web/taglib/BSAbstractMultiCheckedElementTag.java create mode 100644 modules/core/src/main/java/org/springside/modules/web/taglib/BSRadioButtonsTag.java create mode 100644 modules/core/src/main/resources/META-INF/springside-form.tld diff --git a/examples/quickstart/src/main/java/org/springside/examples/quickstart/service/account/ShiroDbRealm.java b/examples/quickstart/src/main/java/org/springside/examples/quickstart/service/account/ShiroDbRealm.java index 5e7bef56..ad59142a 100644 --- a/examples/quickstart/src/main/java/org/springside/examples/quickstart/service/account/ShiroDbRealm.java +++ b/examples/quickstart/src/main/java/org/springside/examples/quickstart/service/account/ShiroDbRealm.java @@ -64,15 +64,20 @@ public class ShiroDbRealm extends AuthorizingRealm { */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { - ShiroUser shiroUser = (ShiroUser) principals.fromRealm(getName()).iterator().next(); - User user = accountService.findUserByLoginName(shiroUser.loginName); - if (user != null) { - SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); - info.addRoles(user.getRoleList()); - return info; - } else { + Object principal = principals.getPrimaryPrincipal(); + if (principal == null) { return null; } + + ShiroUser shiroUser = (ShiroUser) principal; + User user = accountService.findUserByLoginName(shiroUser.loginName); + if (user == null) { + return null; + } + + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + info.addRoles(user.getRoleList()); + return info; } /** diff --git a/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/QuickStartServer.java b/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/QuickStartServer.java index 7e2a619a..5c40d094 100644 --- a/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/QuickStartServer.java +++ b/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/QuickStartServer.java @@ -13,7 +13,8 @@ public class QuickStartServer { public static final int PORT = 8080; public static final String CONTEXT = "/quickstart"; public static final String BASE_URL = "http://localhost:8080/quickstart"; - public static final String[] TLD_JAR_NAMES = new String[] { "sitemesh", "spring-webmvc", "shiro-web" }; + public static final String[] TLD_JAR_NAMES = new String[] { "sitemesh", "spring-webmvc", "shiro-web", + "springside-core" }; public static void main(String[] args) throws Exception { //设定Spring的profile diff --git a/examples/showcase/src/main/java/org/springside/examples/showcase/service/ShiroDbRealm.java b/examples/showcase/src/main/java/org/springside/examples/showcase/service/ShiroDbRealm.java index 087497e7..b188788e 100644 --- a/examples/showcase/src/main/java/org/springside/examples/showcase/service/ShiroDbRealm.java +++ b/examples/showcase/src/main/java/org/springside/examples/showcase/service/ShiroDbRealm.java @@ -70,20 +70,25 @@ public class ShiroDbRealm extends AuthorizingRealm { */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { - ShiroUser shiroUser = (ShiroUser) principals.fromRealm(getName()).iterator().next(); - User user = accountService.findUserByLoginName(shiroUser.loginName); - if (user != null) { - SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); - for (Role role : user.getRoleList()) { - //基于Role的权限信息 - info.addRole(role.getName()); - //基于Permission的权限信息 - info.addStringPermissions(role.getPermissionList()); - } - return info; - } else { + Object principal = principals.getPrimaryPrincipal(); + if (principal == null) { return null; } + + ShiroUser shiroUser = (ShiroUser) principal; + User user = accountService.findUserByLoginName(shiroUser.loginName); + if (user == null) { + return null; + } + + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + for (Role role : user.getRoleList()) { + //基于Role的权限信息 + info.addRole(role.getName()); + //基于Permission的权限信息 + info.addStringPermissions(role.getPermissionList()); + } + return info; } /** diff --git a/examples/showcase/src/main/java/org/springside/examples/showcase/web/UserController.java b/examples/showcase/src/main/java/org/springside/examples/showcase/web/UserController.java index d9066252..cfe3a0c7 100644 --- a/examples/showcase/src/main/java/org/springside/examples/showcase/web/UserController.java +++ b/examples/showcase/src/main/java/org/springside/examples/showcase/web/UserController.java @@ -1,6 +1,7 @@ package org.springside.examples.showcase.web; import java.util.List; +import java.util.Map; import javax.validation.Valid; @@ -19,7 +20,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springside.examples.showcase.entity.User; import org.springside.examples.showcase.service.AccountService; -import com.google.common.collect.Lists; +import com.google.common.collect.Maps; @Controller @RequestMapping(value = "/account/user") @@ -28,9 +29,16 @@ public class UserController { @Autowired private AccountService accountService; + private static Map allStatus = Maps.newHashMap(); + + static { + allStatus.put("enabled", "Enabled"); + allStatus.put("disabled", "Disabled"); + } + //特别设定多个ReuireRoles之间为Or关系,而不是默认的And. @RequiresRoles(value = { "Admin", "User" }, logical = Logical.OR) - @RequestMapping(value = { "list", "" }) + @RequestMapping(value = "") public String list(Model model) { List users = accountService.getAllUser(); model.addAttribute("users", users); @@ -41,7 +49,6 @@ public class UserController { @RequestMapping(value = "update/{id}") public String updateForm(@PathVariable("id") Long id, Model model) { model.addAttribute("user", accountService.getUser(id)); - List allStatus = Lists.newArrayList("enabled", "disabled"); model.addAttribute("allStatus", allStatus); return "account/userForm"; } diff --git a/examples/showcase/src/main/webapp/WEB-INF/springside-form.tld b/examples/showcase/src/main/webapp/WEB-INF/springside-form.tld new file mode 100644 index 00000000..66293c13 --- /dev/null +++ b/examples/showcase/src/main/webapp/WEB-INF/springside-form.tld @@ -0,0 +1,2599 @@ + + + + Spring Framework JSP Form Tag Library extend the radio/checkbox for Twitter BootStrap + 3.0 + form + http://www.springside.org.cn/tags/form + + + Renders an HTML 'form' tag and exposes a binding path to inner tags for binding. + form + org.springframework.web.servlet.tags.form.FormTag + JSP + + HTML Standard Attribute + id + false + true + + + HTML Standard Attribute - added for backwards compatibility cases + name + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + Name of the model attribute under which the form object is exposed. + Defaults to 'command'. + modelAttribute + false + true + + + Name of the model attribute under which the form object is exposed. + Defaults to 'command'. + commandName + false + true + + + HTML Required Attribute + action + false + true + + + HTML Optional Attribute + method + false + true + + + HTML Optional Attribute + target + false + true + + + HTML Optional Attribute + enctype + false + true + + + Specifies the list of character encodings for input data that is accepted by the server processing this form. The value is a space- and/or comma-delimited list of charset values. The client must interpret this list as an exclusive-or list, i.e., the server is able to accept any single character encoding per entity received. + acceptCharset + false + true + + + HTML Event Attribute + onsubmit + false + true + + + HTML Event Attribute + onreset + false + true + + + Common Optional Attribute + autocomplete + false + true + + + The parameter name used for HTTP methods other then GET and POST. Default is '_method' + methodParam + false + true + + true + + + + Renders an HTML 'input' tag with type 'text' using the bound value. + input + org.springframework.web.servlet.tags.form.InputTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + size + false + true + + + HTML Optional Attribute + maxlength + false + true + + + HTML Optional Attribute + alt + false + true + + + HTML Event Attribute + onselect + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. + readonly + false + true + + + Common Optional Attribute + autocomplete + false + true + + true + + + + Renders an HTML 'input' tag with type 'password' using the bound value. + password + org.springframework.web.servlet.tags.form.PasswordInputTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + size + false + true + + + HTML Optional Attribute + maxlength + false + true + + + HTML Optional Attribute + alt + false + true + + + HTML Event Attribute + onselect + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. + readonly + false + true + + + Common Optional Attribute + autocomplete + false + true + + + Is the password value to be shown? Defaults to false. + showPassword + false + true + + true + + + + Renders an HTML 'input' tag with type 'hidden' using the bound value. + hidden + org.springframework.web.servlet.tags.form.HiddenInputTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders an HTML 'select' element. Supports databinding to the selected option. + select + org.springframework.web.servlet.tags.form.SelectTag + JSP + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the inner 'option' tags + items + false + true + + + Name of the property mapped to 'value' attribute of the 'option' tag + itemValue + false + true + + + Name of the property mapped to the inner text of the 'option' tag + itemLabel + false + true + + + HTML Optional Attribute + size + false + true + + + HTML Optional Attribute + multiple + false + true + + true + + + + Renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value. + option + org.springframework.web.servlet.tags.form.OptionTag + JSP + + The actual value bound to the 'value' attribute + value + java.lang.Object + + + The String representation of thr value bound to the 'value' attribute, taking into consideration + any PropertyEditor associated with the enclosing 'select' tag. + displayValue + java.lang.String + + + HTML Standard Attribute + id + false + true + + + HTML Optional Attribute + value + true + true + + + HTML Optional Attribute + label + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders a list of HTML 'option' tags. Sets 'selected' as appropriate based on bound value. + options + org.springframework.web.servlet.tags.form.OptionsTag + empty + + HTML Standard Attribute + id + false + true + + + The Collection, Map or array of objects used to generate the inner 'option' tags. This attribute is required unless the containing select's property for data binding is an Enum, in which case the enum's values are used. + items + false + true + + + Name of the property mapped to 'value' attribute of the 'option' tag + itemValue + false + true + + + Name of the property mapped to the inner text of the 'option' tag + itemLabel + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders an HTML 'input' tag with type 'radio'. + radiobutton + org.springframework.web.servlet.tags.form.RadioButtonTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + value + false + true + + + Value to be displayed as part of the tag + label + false + true + + true + + + + Renders multiple HTML 'input' tags with type 'radio'. + radiobuttons + org.springframework.web.servlet.tags.form.RadioButtonsTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the 'input' tags with type 'radio'. This attribute is required unless the property for data binding is an Enum, in which case the enum's values are used. + items + false + true + + + Name of the property mapped to 'value' attribute of the 'input' tags with type 'radio' + itemValue + false + true + + + Value to be displayed as part of the 'input' tags with type 'radio' + itemLabel + false + true + + + Delimiter to use between each 'input' tag with type 'radio'. There is no delimiter by default. + delimiter + false + true + + + Specifies the HTML element that is used to enclose each 'input' tag with type 'radio'. Defaults to 'span'. + element + false + true + + true + + + + Renders an HTML 'input' tag with type 'checkbox'. + checkbox + org.springframework.web.servlet.tags.form.CheckboxTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + value + false + true + + + Value to be displayed as part of the tag + label + false + true + + true + + + + Renders multiple HTML 'input' tags with type 'checkbox'. + checkboxes + org.springframework.web.servlet.tags.form.CheckboxesTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the 'input' tags with type 'checkbox' + items + true + true + + + Name of the property mapped to 'value' attribute of the 'input' tags with type 'checkbox' + itemValue + false + true + + + Value to be displayed as part of the 'input' tags with type 'checkbox' + itemLabel + false + true + + + Delimiter to use between each 'input' tag with type 'checkbox'. There is no delimiter by default. + delimiter + false + true + + + Specifies the HTML element that is used to enclose each 'input' tag with type 'checkbox'. Defaults to 'span'. + element + false + true + + true + + + + Renders an HTML 'textarea'. + textarea + org.springframework.web.servlet.tags.form.TextareaTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Required Attribute + rows + false + true + + + HTML Required Attribute + cols + false + true + + + HTML Event Attribute + onselect + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. + readonly + false + true + + true + + + + Renders field errors in an HTML 'span' tag. + errors + org.springframework.web.servlet.tags.form.ErrorsTag + JSP + + messages + java.util.List + + + Path to errors object for data binding + path + false + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Delimiter for displaying multiple error messages. Defaults to the br tag. + delimiter + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + Specifies the HTML element that is used to render the enclosing errors. + element + false + true + + true + + + + Renders a form field label in an HTML 'label' tag. + label + org.springframework.web.servlet.tags.form.LabelTag + JSP + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + HTML Standard Attribute + for + false + true + + + Equivalent to "class" - HTML Optional Attribute. + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used only when errors are present. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders an HTML 'button' tag. + button + org.springframework.web.servlet.tags.form.ButtonTag + JSP + + HTML Standard Attribute + id + false + true + + + The name attribute for the HTML button tag + name + false + true + + + The value attribute for the HTML button tag + value + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + true + + + + Renders multiple HTML 'input' tags with type 'radio',follow Twitter BootStrap style. + bsradiobuttons + org.springside.modules.web.taglib.BSRadioButtonsTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the 'input' tags with type 'radio'. This attribute is required unless the property for data binding is an Enum, in which case the enum's values are used. + items + false + true + + + Name of the property mapped to 'value' attribute of the 'input' tags with type 'radio' + itemValue + false + true + + + Value to be displayed as part of the 'input' tags with type 'radio' + itemLabel + false + true + + + Delimiter to use between each 'input' tag with type 'radio'. There is no delimiter by default. + delimiter + false + true + + + Specifies the HTML element that is used to enclose each 'input' tag with type 'radio'. Defaults to 'span'. + element + false + true + + true + + + diff --git a/examples/showcase/src/main/webapp/WEB-INF/views/account/userForm.jsp b/examples/showcase/src/main/webapp/WEB-INF/views/account/userForm.jsp index 0f174082..00054a2e 100644 --- a/examples/showcase/src/main/webapp/WEB-INF/views/account/userForm.jsp +++ b/examples/showcase/src/main/webapp/WEB-INF/views/account/userForm.jsp @@ -1,6 +1,6 @@ <%@ page contentType="text/html;charset=UTF-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="form" uri="http://www.springside.org.cn/tags/form" %> <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> @@ -59,7 +59,7 @@
- +
diff --git a/modules/core/pom.xml b/modules/core/pom.xml index b6c14f71..c2e9a908 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -43,6 +43,15 @@ + + + org.springframework + spring-webmvc + true + + + + com.google.guava diff --git a/modules/core/src/main/java/org/springside/modules/web/taglib/BSAbstractMultiCheckedElementTag.java b/modules/core/src/main/java/org/springside/modules/web/taglib/BSAbstractMultiCheckedElementTag.java new file mode 100644 index 00000000..2054bdb4 --- /dev/null +++ b/modules/core/src/main/java/org/springside/modules/web/taglib/BSAbstractMultiCheckedElementTag.java @@ -0,0 +1,125 @@ +package org.springside.modules.web.taglib; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +import javax.servlet.jsp.JspException; + +import org.springframework.beans.BeanWrapper; +import org.springframework.beans.PropertyAccessorFactory; +import org.springframework.util.ObjectUtils; +import org.springframework.web.servlet.tags.form.AbstractMultiCheckedElementTag; +import org.springframework.web.servlet.tags.form.TagWriter; + +public abstract class BSAbstractMultiCheckedElementTag extends AbstractMultiCheckedElementTag { + + /** + * Renders the 'input type="radio"' element with the configured + * {@link #setItems(Object)} values. Marks the element as checked if the + * value matches the bound value. + */ + @Override + protected int writeTagContent(TagWriter tagWriter) throws JspException { + Object items = getItems(); + Object itemsObject = (items instanceof String ? evaluate("items", items) : items); + + String itemValue = getItemValue(); + String itemLabel = getItemLabel(); + String valueProperty = (itemValue != null ? ObjectUtils.getDisplayString(evaluate("itemValue", itemValue)) + : null); + String labelProperty = (itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) + : null); + + Class boundType = getBindStatus().getValueType(); + if (itemsObject == null && boundType != null && boundType.isEnum()) { + itemsObject = boundType.getEnumConstants(); + } + + if (itemsObject == null) { + throw new IllegalArgumentException( + "Attribute 'items' is required and must be a Collection, an Array or a Map"); + } + + if (itemsObject.getClass().isArray()) { + Object[] itemsArray = (Object[]) itemsObject; + for (int i = 0; i < itemsArray.length; i++) { + Object item = itemsArray[i]; + writeObjectEntry(tagWriter, valueProperty, labelProperty, item, i); + } + } else if (itemsObject instanceof Collection) { + final Collection optionCollection = (Collection) itemsObject; + int itemIndex = 0; + for (Iterator it = optionCollection.iterator(); it.hasNext(); itemIndex++) { + Object item = it.next(); + writeObjectEntry(tagWriter, valueProperty, labelProperty, item, itemIndex); + } + } else if (itemsObject instanceof Map) { + final Map optionMap = (Map) itemsObject; + int itemIndex = 0; + for (Iterator it = optionMap.entrySet().iterator(); it.hasNext(); itemIndex++) { + Map.Entry entry = (Map.Entry) it.next(); + writeMapEntry(tagWriter, valueProperty, labelProperty, entry, itemIndex); + } + } else { + throw new IllegalArgumentException("Attribute 'items' must be an array, a Collection or a Map"); + } + + return SKIP_BODY; + } + + private void writeObjectEntry(TagWriter tagWriter, String valueProperty, String labelProperty, Object item, + int itemIndex) throws JspException { + + BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(item); + Object renderValue; + if (valueProperty != null) { + renderValue = wrapper.getPropertyValue(valueProperty); + } else if (item instanceof Enum) { + renderValue = ((Enum) item).name(); + } else { + renderValue = item; + } + Object renderLabel = (labelProperty != null ? wrapper.getPropertyValue(labelProperty) : item); + writeElementTag(tagWriter, item, renderValue, renderLabel, itemIndex); + } + + private void writeMapEntry(TagWriter tagWriter, String valueProperty, String labelProperty, Map.Entry entry, + int itemIndex) throws JspException { + + Object mapKey = entry.getKey(); + Object mapValue = entry.getValue(); + BeanWrapper mapKeyWrapper = PropertyAccessorFactory.forBeanPropertyAccess(mapKey); + BeanWrapper mapValueWrapper = PropertyAccessorFactory.forBeanPropertyAccess(mapValue); + Object renderValue = (valueProperty != null ? mapKeyWrapper.getPropertyValue(valueProperty) : mapKey.toString()); + Object renderLabel = (labelProperty != null ? mapValueWrapper.getPropertyValue(labelProperty) : mapValue + .toString()); + writeElementTag(tagWriter, mapKey, renderValue, renderLabel, itemIndex); + } + + private void writeElementTag(TagWriter tagWriter, Object item, Object value, Object label, int itemIndex) + throws JspException { + String id = resolveId(); + tagWriter.startTag("label"); + tagWriter.writeAttribute("for", id); + tagWriter.writeAttribute("class", getInputType()); + + if (itemIndex > 0) { + Object resolvedDelimiter = evaluate("delimiter", getDelimiter()); + if (resolvedDelimiter != null) { + tagWriter.appendValue(resolvedDelimiter.toString()); + } + } + tagWriter.startTag("input"); + + writeOptionalAttribute(tagWriter, "id", id); + writeOptionalAttribute(tagWriter, "name", getName()); + writeOptionalAttributes(tagWriter); + tagWriter.writeAttribute("type", getInputType()); + renderFromValue(item, value, tagWriter); + tagWriter.endTag(); + + tagWriter.appendValue(convertToDisplayString(label)); + tagWriter.endTag(); + } +} diff --git a/modules/core/src/main/java/org/springside/modules/web/taglib/BSRadioButtonsTag.java b/modules/core/src/main/java/org/springside/modules/web/taglib/BSRadioButtonsTag.java new file mode 100644 index 00000000..1d8a5807 --- /dev/null +++ b/modules/core/src/main/java/org/springside/modules/web/taglib/BSRadioButtonsTag.java @@ -0,0 +1,8 @@ +package org.springside.modules.web.taglib; + +public class BSRadioButtonsTag extends BSAbstractMultiCheckedElementTag { + @Override + protected String getInputType() { + return "radio"; + } +} diff --git a/modules/core/src/main/resources/META-INF/springside-form.tld b/modules/core/src/main/resources/META-INF/springside-form.tld new file mode 100644 index 00000000..66293c13 --- /dev/null +++ b/modules/core/src/main/resources/META-INF/springside-form.tld @@ -0,0 +1,2599 @@ + + + + Spring Framework JSP Form Tag Library extend the radio/checkbox for Twitter BootStrap + 3.0 + form + http://www.springside.org.cn/tags/form + + + Renders an HTML 'form' tag and exposes a binding path to inner tags for binding. + form + org.springframework.web.servlet.tags.form.FormTag + JSP + + HTML Standard Attribute + id + false + true + + + HTML Standard Attribute - added for backwards compatibility cases + name + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + Name of the model attribute under which the form object is exposed. + Defaults to 'command'. + modelAttribute + false + true + + + Name of the model attribute under which the form object is exposed. + Defaults to 'command'. + commandName + false + true + + + HTML Required Attribute + action + false + true + + + HTML Optional Attribute + method + false + true + + + HTML Optional Attribute + target + false + true + + + HTML Optional Attribute + enctype + false + true + + + Specifies the list of character encodings for input data that is accepted by the server processing this form. The value is a space- and/or comma-delimited list of charset values. The client must interpret this list as an exclusive-or list, i.e., the server is able to accept any single character encoding per entity received. + acceptCharset + false + true + + + HTML Event Attribute + onsubmit + false + true + + + HTML Event Attribute + onreset + false + true + + + Common Optional Attribute + autocomplete + false + true + + + The parameter name used for HTTP methods other then GET and POST. Default is '_method' + methodParam + false + true + + true + + + + Renders an HTML 'input' tag with type 'text' using the bound value. + input + org.springframework.web.servlet.tags.form.InputTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + size + false + true + + + HTML Optional Attribute + maxlength + false + true + + + HTML Optional Attribute + alt + false + true + + + HTML Event Attribute + onselect + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. + readonly + false + true + + + Common Optional Attribute + autocomplete + false + true + + true + + + + Renders an HTML 'input' tag with type 'password' using the bound value. + password + org.springframework.web.servlet.tags.form.PasswordInputTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + size + false + true + + + HTML Optional Attribute + maxlength + false + true + + + HTML Optional Attribute + alt + false + true + + + HTML Event Attribute + onselect + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. + readonly + false + true + + + Common Optional Attribute + autocomplete + false + true + + + Is the password value to be shown? Defaults to false. + showPassword + false + true + + true + + + + Renders an HTML 'input' tag with type 'hidden' using the bound value. + hidden + org.springframework.web.servlet.tags.form.HiddenInputTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders an HTML 'select' element. Supports databinding to the selected option. + select + org.springframework.web.servlet.tags.form.SelectTag + JSP + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the inner 'option' tags + items + false + true + + + Name of the property mapped to 'value' attribute of the 'option' tag + itemValue + false + true + + + Name of the property mapped to the inner text of the 'option' tag + itemLabel + false + true + + + HTML Optional Attribute + size + false + true + + + HTML Optional Attribute + multiple + false + true + + true + + + + Renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value. + option + org.springframework.web.servlet.tags.form.OptionTag + JSP + + The actual value bound to the 'value' attribute + value + java.lang.Object + + + The String representation of thr value bound to the 'value' attribute, taking into consideration + any PropertyEditor associated with the enclosing 'select' tag. + displayValue + java.lang.String + + + HTML Standard Attribute + id + false + true + + + HTML Optional Attribute + value + true + true + + + HTML Optional Attribute + label + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders a list of HTML 'option' tags. Sets 'selected' as appropriate based on bound value. + options + org.springframework.web.servlet.tags.form.OptionsTag + empty + + HTML Standard Attribute + id + false + true + + + The Collection, Map or array of objects used to generate the inner 'option' tags. This attribute is required unless the containing select's property for data binding is an Enum, in which case the enum's values are used. + items + false + true + + + Name of the property mapped to 'value' attribute of the 'option' tag + itemValue + false + true + + + Name of the property mapped to the inner text of the 'option' tag + itemLabel + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders an HTML 'input' tag with type 'radio'. + radiobutton + org.springframework.web.servlet.tags.form.RadioButtonTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + value + false + true + + + Value to be displayed as part of the tag + label + false + true + + true + + + + Renders multiple HTML 'input' tags with type 'radio'. + radiobuttons + org.springframework.web.servlet.tags.form.RadioButtonsTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the 'input' tags with type 'radio'. This attribute is required unless the property for data binding is an Enum, in which case the enum's values are used. + items + false + true + + + Name of the property mapped to 'value' attribute of the 'input' tags with type 'radio' + itemValue + false + true + + + Value to be displayed as part of the 'input' tags with type 'radio' + itemLabel + false + true + + + Delimiter to use between each 'input' tag with type 'radio'. There is no delimiter by default. + delimiter + false + true + + + Specifies the HTML element that is used to enclose each 'input' tag with type 'radio'. Defaults to 'span'. + element + false + true + + true + + + + Renders an HTML 'input' tag with type 'checkbox'. + checkbox + org.springframework.web.servlet.tags.form.CheckboxTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Optional Attribute + value + false + true + + + Value to be displayed as part of the tag + label + false + true + + true + + + + Renders multiple HTML 'input' tags with type 'checkbox'. + checkboxes + org.springframework.web.servlet.tags.form.CheckboxesTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the 'input' tags with type 'checkbox' + items + true + true + + + Name of the property mapped to 'value' attribute of the 'input' tags with type 'checkbox' + itemValue + false + true + + + Value to be displayed as part of the 'input' tags with type 'checkbox' + itemLabel + false + true + + + Delimiter to use between each 'input' tag with type 'checkbox'. There is no delimiter by default. + delimiter + false + true + + + Specifies the HTML element that is used to enclose each 'input' tag with type 'checkbox'. Defaults to 'span'. + element + false + true + + true + + + + Renders an HTML 'textarea'. + textarea + org.springframework.web.servlet.tags.form.TextareaTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + HTML Required Attribute + rows + false + true + + + HTML Required Attribute + cols + false + true + + + HTML Event Attribute + onselect + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. + readonly + false + true + + true + + + + Renders field errors in an HTML 'span' tag. + errors + org.springframework.web.servlet.tags.form.ErrorsTag + JSP + + messages + java.util.List + + + Path to errors object for data binding + path + false + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Delimiter for displaying multiple error messages. Defaults to the br tag. + delimiter + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + Specifies the HTML element that is used to render the enclosing errors. + element + false + true + + true + + + + Renders a form field label in an HTML 'label' tag. + label + org.springframework.web.servlet.tags.form.LabelTag + JSP + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + HTML Standard Attribute + for + false + true + + + Equivalent to "class" - HTML Optional Attribute. + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used only when errors are present. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + true + + + + Renders an HTML 'button' tag. + button + org.springframework.web.servlet.tags.form.ButtonTag + JSP + + HTML Standard Attribute + id + false + true + + + The name attribute for the HTML button tag + name + false + true + + + The value attribute for the HTML button tag + value + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + true + + + + Renders multiple HTML 'input' tags with type 'radio',follow Twitter BootStrap style. + bsradiobuttons + org.springside.modules.web.taglib.BSRadioButtonsTag + empty + + Path to property for data binding + path + true + true + + + HTML Standard Attribute + id + false + true + + + Enable/disable HTML escaping of rendered values. + htmlEscape + false + true + + + Equivalent to "class" - HTML Optional Attribute + cssClass + false + true + + + Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. + cssErrorClass + false + true + + + Equivalent to "style" - HTML Optional Attribute + cssStyle + false + true + + + HTML Standard Attribute + lang + false + true + + + HTML Standard Attribute + title + false + true + + + HTML Standard Attribute + dir + false + true + + + HTML Standard Attribute + tabindex + false + true + + + HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. + disabled + false + true + + + HTML Event Attribute + onclick + false + true + + + HTML Event Attribute + ondblclick + false + true + + + HTML Event Attribute + onmousedown + false + true + + + HTML Event Attribute + onmouseup + false + true + + + HTML Event Attribute + onmouseover + false + true + + + HTML Event Attribute + onmousemove + false + true + + + HTML Event Attribute + onmouseout + false + true + + + HTML Event Attribute + onkeypress + false + true + + + HTML Event Attribute + onkeyup + false + true + + + HTML Event Attribute + onkeydown + false + true + + + HTML Event Attribute + onfocus + false + true + + + HTML Event Attribute + onblur + false + true + + + HTML Event Attribute + onchange + false + true + + + HTML Standard Attribute + accesskey + false + true + + + The Collection, Map or array of objects used to generate the 'input' tags with type 'radio'. This attribute is required unless the property for data binding is an Enum, in which case the enum's values are used. + items + false + true + + + Name of the property mapped to 'value' attribute of the 'input' tags with type 'radio' + itemValue + false + true + + + Value to be displayed as part of the 'input' tags with type 'radio' + itemLabel + false + true + + + Delimiter to use between each 'input' tag with type 'radio'. There is no delimiter by default. + delimiter + false + true + + + Specifies the HTML element that is used to enclose each 'input' tag with type 'radio'. Defaults to 'span'. + element + false + true + + true + + + diff --git a/modules/core/src/main/resources/META-INF/springside-shiro.tld b/modules/core/src/main/resources/META-INF/springside-shiro.tld index ccb0cfbe..3b03bb5c 100644 --- a/modules/core/src/main/resources/META-INF/springside-shiro.tld +++ b/modules/core/src/main/resources/META-INF/springside-shiro.tld @@ -30,7 +30,7 @@ http://www.springside.org.cn/tags/shiro - Apache Shiro JSP Tag Library. + Apache Shiro JSP Tag Library extends the hasAnyPermissions tag. hasPermission