1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.components;
19
20 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.http.HttpServletResponse;
22
23 import com.opensymphony.xwork2.util.ValueStack;
24
25 /***
26 * <!-- START SNIPPET: javadoc -->
27 * Render HTML textarea tag.</p>
28 * <!-- END SNIPPET: javadoc -->
29 *
30 * <p/> <b>Examples</b>
31 *
32 * <pre>
33 * <!-- START SNIPPET: example -->
34 * <s:textarea label="Comments" name="comments" cols="30" rows="8"/>
35 * <!-- END SNIPPET: example -->
36 * </pre>
37 *
38 * @see TabbedPanel
39 *
40 * @s.tag name="textarea" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TextareaTag"
41 * description="Render HTML textarea tag."
42 */
43 public class TextArea extends UIBean {
44 final public static String TEMPLATE = "textarea";
45
46 protected String cols;
47 protected String readonly;
48 protected String rows;
49 protected String wrap;
50
51 public TextArea(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
52 super(stack, request, response);
53 }
54
55 protected String getDefaultTemplate() {
56 return TEMPLATE;
57 }
58
59 public void evaluateExtraParams() {
60 super.evaluateExtraParams();
61
62 if (readonly != null) {
63 addParameter("readonly", findValue(readonly, Boolean.class));
64 }
65
66 if (cols != null) {
67 addParameter("cols", findString(cols));
68 }
69
70 if (rows != null) {
71 addParameter("rows", findString(rows));
72 }
73
74 if (wrap != null) {
75 addParameter("wrap", findString(wrap));
76 }
77 }
78
79 /***
80 * HTML cols attribute
81 * @s.tagattribute required="false" type="Integer"
82 */
83 public void setCols(String cols) {
84 this.cols = cols;
85 }
86
87 /***
88 * Whether the textarea is readonly
89 * @s.tagattribute required="false" type="Boolean" default="false"
90 */
91 public void setReadonly(String readonly) {
92 this.readonly = readonly;
93 }
94
95 /***
96 * HTML rows attribute
97 * @s.tagattribute required="false" type="Integer"
98 */
99 public void setRows(String rows) {
100 this.rows = rows;
101 }
102
103 /***
104 * HTML wrap attribute
105 * @s.tagattribute required="false" type="String"
106 */
107 public void setWrap(String wrap) {
108 this.wrap = wrap;
109 }
110 }