JSP HiddenInputTag allows for using common HTML attributes (SPR-7249)

This commit is contained in:
Juergen Hoeller 2010-06-07 20:32:52 +00:00
parent 2ef3a86c4f
commit 78c906caaa
4 changed files with 146 additions and 44 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,7 +18,6 @@ package org.springframework.web.servlet.tags.form;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.DynamicAttributes;
@ -40,7 +39,7 @@ import org.springframework.util.StringUtils;
* @author Jeremy Grelle
* @since 2.0
*/
public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElementTag implements DynamicAttributes{
public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElementTag implements DynamicAttributes {
public static final String CLASS_ATTRIBUTE = "class";

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,7 +31,7 @@ import javax.servlet.jsp.JspException;
* @author Juergen Hoeller
* @since 2.0
*/
public class HiddenInputTag extends AbstractDataBoundFormElementTag {
public class HiddenInputTag extends AbstractHtmlElementTag {
/**
* Writes the HTML '<code>input</code>' tag to the supplied {@link TagWriter} including the

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>Spring Framework JSP Form Tag Library</description>
<tlib-version>3.0</tlib-version>
<short-name>form</short-name>
<uri>http://www.springframework.org/tags/form</uri>
<tag>
<description>Renders an HTML 'form' tag and exposes a binding path to inner tags for binding.</description>
<name>form</name>
@ -192,7 +192,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'input' tag with type 'text' using the bound value.</description>
<name>input</name>
@ -386,7 +386,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'input' tag with type 'password' using the bound value.</description>
<name>password</name>
@ -586,7 +586,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'input' tag with type 'hidden' using the bound value.</description>
<name>hidden</name>
@ -610,8 +610,111 @@
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Equivalent to "class" - HTML Optional Attribute</description>
<name>cssClass</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors.</description>
<name>cssErrorClass</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>Equivalent to "style" - HTML Optional Attribute</description>
<name>cssStyle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Standard Attribute</description>
<name>lang</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Standard Attribute</description>
<name>title</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Standard Attribute</description>
<name>dir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Standard Attribute</description>
<name>tabindex</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onclick</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>ondblclick</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onmousedown</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onmouseup</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onmouseover</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onmousemove</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onmouseout</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onkeypress</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onkeyup</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>HTML Event Attribute</description>
<name>onkeydown</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'select' element. Supports databinding to the selected option.</description>
<name>select</name>
@ -799,7 +902,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value.</description>
<name>option</name>
@ -950,7 +1053,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders a list of HTML 'option' tags. Sets 'selected' as appropriate based on bound value.</description>
<name>options</name>
@ -1096,7 +1199,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'input' tag with type 'radio'.</description>
<name>radiobutton</name>
@ -1266,7 +1369,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders multiple HTML 'input' tags with type 'radio'.</description>
<name>radiobuttons</name>
@ -1454,7 +1557,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'input' tag with type 'checkbox'.</description>
<name>checkbox</name>
@ -1624,7 +1727,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders multiple HTML 'input' tags with type 'checkbox'.</description>
<name>checkboxes</name>
@ -1812,7 +1915,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders an HTML 'textarea'.</description>
<name>textarea</name>
@ -1994,7 +2097,7 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders field errors in an HTML 'span' tag.</description>
<name>errors</name>
@ -2132,14 +2235,14 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
<description>Renders a form field label in an HTML 'label' tag.</description>
<name>label</name>
<tag-class>org.springframework.web.servlet.tags.form.LabelTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>Path to errors object for data binding</description>
<description>Path to property for data binding</description>
<name>path</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
@ -2266,5 +2369,5 @@
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
</taglib>
</taglib>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>Spring Framework JSP Tag Library</description>
<tlib-version>3.0</tlib-version>
<short-name>spring</short-name>
<uri>http://www.springframework.org/tags</uri>
<tag>
<description>
Sets default HTML escape value for the current page.
@ -25,7 +25,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Escapes its enclosed body content, applying HTML escaping and/or JavaScript escaping.
@ -50,7 +50,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Retrieves the message with the given code, or text if code isn't resolvable.
@ -133,7 +133,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Retrieves the theme message with the given code, or text if code isn't resolvable.
@ -210,7 +210,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Provides Errors instance in case of bind errors.
@ -240,7 +240,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Sets a nested path to be used by the bind tag's path.
@ -261,7 +261,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Provides BindStatus object for the given bind path.
@ -298,7 +298,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Provides transformation of variables to Strings, using an appropriate
@ -341,7 +341,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>URL tag based on the JSTL c:url tag. This variant is fully
backwards compatible with the standard tag. Enhancements include support
@ -393,7 +393,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>Parameter tag based on the JSTL c:param tag. The sole purpose is to
support params inside the spring:url tag.</description>
@ -413,7 +413,7 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>Evaluates a Spring expression (SpEL) and either prints the result or assigns it to a variable.</description>
<name>eval</name>
@ -453,5 +453,5 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
</taglib>