Skip to content

Commit 78c906c

Browse files
committed
JSP HiddenInputTag allows for using common HTML attributes (SPR-7249)
1 parent 2ef3a86 commit 78c906c

File tree

4 files changed

+146
-44
lines changed

4 files changed

+146
-44
lines changed

org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.util.HashMap;
2020
import java.util.Map;
21-
2221
import javax.servlet.jsp.JspException;
2322
import javax.servlet.jsp.tagext.DynamicAttributes;
2423

@@ -40,7 +39,7 @@
4039
* @author Jeremy Grelle
4140
* @since 2.0
4241
*/
43-
public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElementTag implements DynamicAttributes{
42+
public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElementTag implements DynamicAttributes {
4443

4544
public static final String CLASS_ATTRIBUTE = "class";
4645

org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/HiddenInputTag.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
3131
* @author Juergen Hoeller
3232
* @since 2.0
3333
*/
34-
public class HiddenInputTag extends AbstractDataBoundFormElementTag {
34+
public class HiddenInputTag extends AbstractHtmlElementTag {
3535

3636
/**
3737
* Writes the HTML '<code>input</code>' tag to the supplied {@link TagWriter} including the

org.springframework.web.servlet/src/main/resources/META-INF/spring-form.tld

Lines changed: 125 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5-
version="2.0">
6-
2+
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5+
version="2.0">
6+
77
<description>Spring Framework JSP Form Tag Library</description>
88
<tlib-version>3.0</tlib-version>
99
<short-name>form</short-name>
1010
<uri>http://www.springframework.org/tags/form</uri>
11-
11+
1212
<tag>
1313
<description>Renders an HTML 'form' tag and exposes a binding path to inner tags for binding.</description>
1414
<name>form</name>
@@ -192,7 +192,7 @@
192192
</attribute>
193193
<dynamic-attributes>true</dynamic-attributes>
194194
</tag>
195-
195+
196196
<tag>
197197
<description>Renders an HTML 'input' tag with type 'text' using the bound value.</description>
198198
<name>input</name>
@@ -386,7 +386,7 @@
386386
</attribute>
387387
<dynamic-attributes>true</dynamic-attributes>
388388
</tag>
389-
389+
390390
<tag>
391391
<description>Renders an HTML 'input' tag with type 'password' using the bound value.</description>
392392
<name>password</name>
@@ -586,7 +586,7 @@
586586
</attribute>
587587
<dynamic-attributes>true</dynamic-attributes>
588588
</tag>
589-
589+
590590
<tag>
591591
<description>Renders an HTML 'input' tag with type 'hidden' using the bound value.</description>
592592
<name>hidden</name>
@@ -610,8 +610,111 @@
610610
<required>false</required>
611611
<rtexprvalue>true</rtexprvalue>
612612
</attribute>
613+
<attribute>
614+
<description>Equivalent to "class" - HTML Optional Attribute</description>
615+
<name>cssClass</name>
616+
<required>false</required>
617+
<rtexprvalue>true</rtexprvalue>
618+
</attribute>
619+
<attribute>
620+
<description>Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors.</description>
621+
<name>cssErrorClass</name>
622+
<required>false</required>
623+
<rtexprvalue>true</rtexprvalue>
624+
</attribute>
625+
<attribute>
626+
<description>Equivalent to "style" - HTML Optional Attribute</description>
627+
<name>cssStyle</name>
628+
<required>false</required>
629+
<rtexprvalue>true</rtexprvalue>
630+
</attribute>
631+
<attribute>
632+
<description>HTML Standard Attribute</description>
633+
<name>lang</name>
634+
<required>false</required>
635+
<rtexprvalue>true</rtexprvalue>
636+
</attribute>
637+
<attribute>
638+
<description>HTML Standard Attribute</description>
639+
<name>title</name>
640+
<required>false</required>
641+
<rtexprvalue>true</rtexprvalue>
642+
</attribute>
643+
<attribute>
644+
<description>HTML Standard Attribute</description>
645+
<name>dir</name>
646+
<required>false</required>
647+
<rtexprvalue>true</rtexprvalue>
648+
</attribute>
649+
<attribute>
650+
<description>HTML Standard Attribute</description>
651+
<name>tabindex</name>
652+
<required>false</required>
653+
<rtexprvalue>true</rtexprvalue>
654+
</attribute>
655+
<attribute>
656+
<description>HTML Event Attribute</description>
657+
<name>onclick</name>
658+
<required>false</required>
659+
<rtexprvalue>true</rtexprvalue>
660+
</attribute>
661+
<attribute>
662+
<description>HTML Event Attribute</description>
663+
<name>ondblclick</name>
664+
<required>false</required>
665+
<rtexprvalue>true</rtexprvalue>
666+
</attribute>
667+
<attribute>
668+
<description>HTML Event Attribute</description>
669+
<name>onmousedown</name>
670+
<required>false</required>
671+
<rtexprvalue>true</rtexprvalue>
672+
</attribute>
673+
<attribute>
674+
<description>HTML Event Attribute</description>
675+
<name>onmouseup</name>
676+
<required>false</required>
677+
<rtexprvalue>true</rtexprvalue>
678+
</attribute>
679+
<attribute>
680+
<description>HTML Event Attribute</description>
681+
<name>onmouseover</name>
682+
<required>false</required>
683+
<rtexprvalue>true</rtexprvalue>
684+
</attribute>
685+
<attribute>
686+
<description>HTML Event Attribute</description>
687+
<name>onmousemove</name>
688+
<required>false</required>
689+
<rtexprvalue>true</rtexprvalue>
690+
</attribute>
691+
<attribute>
692+
<description>HTML Event Attribute</description>
693+
<name>onmouseout</name>
694+
<required>false</required>
695+
<rtexprvalue>true</rtexprvalue>
696+
</attribute>
697+
<attribute>
698+
<description>HTML Event Attribute</description>
699+
<name>onkeypress</name>
700+
<required>false</required>
701+
<rtexprvalue>true</rtexprvalue>
702+
</attribute>
703+
<attribute>
704+
<description>HTML Event Attribute</description>
705+
<name>onkeyup</name>
706+
<required>false</required>
707+
<rtexprvalue>true</rtexprvalue>
708+
</attribute>
709+
<attribute>
710+
<description>HTML Event Attribute</description>
711+
<name>onkeydown</name>
712+
<required>false</required>
713+
<rtexprvalue>true</rtexprvalue>
714+
</attribute>
715+
<dynamic-attributes>true</dynamic-attributes>
613716
</tag>
614-
717+
615718
<tag>
616719
<description>Renders an HTML 'select' element. Supports databinding to the selected option.</description>
617720
<name>select</name>
@@ -799,7 +902,7 @@
799902
</attribute>
800903
<dynamic-attributes>true</dynamic-attributes>
801904
</tag>
802-
905+
803906
<tag>
804907
<description>Renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value.</description>
805908
<name>option</name>
@@ -950,7 +1053,7 @@
9501053
</attribute>
9511054
<dynamic-attributes>true</dynamic-attributes>
9521055
</tag>
953-
1056+
9541057
<tag>
9551058
<description>Renders a list of HTML 'option' tags. Sets 'selected' as appropriate based on bound value.</description>
9561059
<name>options</name>
@@ -1096,7 +1199,7 @@
10961199
</attribute>
10971200
<dynamic-attributes>true</dynamic-attributes>
10981201
</tag>
1099-
1202+
11001203
<tag>
11011204
<description>Renders an HTML 'input' tag with type 'radio'.</description>
11021205
<name>radiobutton</name>
@@ -1266,7 +1369,7 @@
12661369
</attribute>
12671370
<dynamic-attributes>true</dynamic-attributes>
12681371
</tag>
1269-
1372+
12701373
<tag>
12711374
<description>Renders multiple HTML 'input' tags with type 'radio'.</description>
12721375
<name>radiobuttons</name>
@@ -1454,7 +1557,7 @@
14541557
</attribute>
14551558
<dynamic-attributes>true</dynamic-attributes>
14561559
</tag>
1457-
1560+
14581561
<tag>
14591562
<description>Renders an HTML 'input' tag with type 'checkbox'.</description>
14601563
<name>checkbox</name>
@@ -1624,7 +1727,7 @@
16241727
</attribute>
16251728
<dynamic-attributes>true</dynamic-attributes>
16261729
</tag>
1627-
1730+
16281731
<tag>
16291732
<description>Renders multiple HTML 'input' tags with type 'checkbox'.</description>
16301733
<name>checkboxes</name>
@@ -1812,7 +1915,7 @@
18121915
</attribute>
18131916
<dynamic-attributes>true</dynamic-attributes>
18141917
</tag>
1815-
1918+
18161919
<tag>
18171920
<description>Renders an HTML 'textarea'.</description>
18181921
<name>textarea</name>
@@ -1994,7 +2097,7 @@
19942097
</attribute>
19952098
<dynamic-attributes>true</dynamic-attributes>
19962099
</tag>
1997-
2100+
19982101
<tag>
19992102
<description>Renders field errors in an HTML 'span' tag.</description>
20002103
<name>errors</name>
@@ -2132,14 +2235,14 @@
21322235
</attribute>
21332236
<dynamic-attributes>true</dynamic-attributes>
21342237
</tag>
2135-
2238+
21362239
<tag>
21372240
<description>Renders a form field label in an HTML 'label' tag.</description>
21382241
<name>label</name>
21392242
<tag-class>org.springframework.web.servlet.tags.form.LabelTag</tag-class>
21402243
<body-content>JSP</body-content>
21412244
<attribute>
2142-
<description>Path to errors object for data binding</description>
2245+
<description>Path to property for data binding</description>
21432246
<name>path</name>
21442247
<required>true</required>
21452248
<rtexprvalue>true</rtexprvalue>
@@ -2266,5 +2369,5 @@
22662369
</attribute>
22672370
<dynamic-attributes>true</dynamic-attributes>
22682371
</tag>
2269-
2270-
</taglib>
2372+
2373+
</taglib>

0 commit comments

Comments
 (0)