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