KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > servlet > tags > form > TextareaTag


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.servlet.tags.form;
18
19 import javax.servlet.jsp.JspException JavaDoc;
20
21
22 /**
23  * Databinding-aware JSP tag for rendering an HTML '<code>textarea</code>'.
24  *
25  * @author Rob Harrop
26  * @since 2.0
27  */

28 public class TextareaTag extends AbstractHtmlInputElementTag {
29
30     /**
31      * The name of the '<code>rows</code>' attribute.
32      */

33     public static final String JavaDoc ROWS_ATTRIBUTE = "rows";
34
35     /**
36      * The name of the '<code>cols</code>' attribute.
37      */

38     public static final String JavaDoc COLS_ATTRIBUTE = "cols";
39
40     /**
41      * The name of the '<code>onselect</code>' attribute.
42      */

43     public static final String JavaDoc ONSELECT_ATTRIBUTE = "onselect";
44
45
46     /**
47      * The value of the '<code>rows</code>' attribute.
48      */

49     private String JavaDoc rows;
50
51     /**
52      * The value of the '<code>cols</code>' attribute.
53      */

54     private String JavaDoc cols;
55
56     /**
57      * The value of the '<code>onselect</code>' attribute.
58      */

59     private String JavaDoc onselect;
60
61     /**
62      * Sets the value of the '<code>rows</code>' attribute.
63      * May be a runtime expression.
64      */

65     public void setRows(String JavaDoc rows) {
66         this.rows = rows;
67     }
68
69     /**
70      * Gets the value of the '<code>rows</code>' attribute.
71      * May be a runtime expression.
72      */

73     protected String JavaDoc getRows() {
74         return this.rows;
75     }
76
77     /**
78      * Sets the value of the '<code>cols</code>' attribute.
79      * May be a runtime expression.
80      */

81     public void setCols(String JavaDoc cols) {
82         this.cols = cols;
83     }
84
85     /**
86      * Gets the value of the '<code>cols</code>' attribute.
87      * May be a runtime expression.
88      */

89     protected String JavaDoc getCols() {
90         return this.cols;
91     }
92
93     /**
94      * Sets the value of the '<code>onselect</code>' attribute.
95      * May be a runtime expression.
96      */

97     public void setOnselect(String JavaDoc onselect) {
98         this.onselect = onselect;
99     }
100
101     /**
102      * Gets the value of the '<code>onselect</code>' attribute.
103      * May be a runtime expression.
104      */

105     protected String JavaDoc getOnselect() {
106         return this.onselect;
107     }
108
109
110     protected int writeTagContent(TagWriter tagWriter) throws JspException JavaDoc {
111         tagWriter.startTag("textarea");
112         writeDefaultAttributes(tagWriter);
113         writeOptionalAttribute(tagWriter, ROWS_ATTRIBUTE, getRows());
114         writeOptionalAttribute(tagWriter, COLS_ATTRIBUTE, getCols());
115         writeOptionalAttribute(tagWriter, ONSELECT_ATTRIBUTE, getOnselect());
116         tagWriter.appendValue(getDisplayString(getBoundValue(), getPropertyEditor()));
117         tagWriter.endTag();
118         return EVAL_PAGE;
119     }
120
121 }
122
Popular Tags