1 package org.seasar.cubby.tags;
2
3 import java.io.IOException;
4 import java.util.Map;
5
6 import javax.servlet.jsp.JspException;
7 import javax.servlet.jsp.JspWriter;
8 import javax.servlet.jsp.PageContext;
9
10 import org.seasar.cubby.util.CubbyFunctions;
11 import org.seasar.cubby.util.CubbyHelperFunctions;
12
13
14
15
16
17
18 public class TextareaTag extends DynamicAttributesTagSupport {
19
20
21
22
23 @SuppressWarnings("unchecked")
24 @Override
25 public void doTag() throws JspException, IOException {
26 final Object form = getJspContext().getAttribute("__form",
27 PageContext.REQUEST_SCOPE);
28 final Object value = CubbyHelperFunctions.formValue(
29 getDynamicAttribute(), form, getJspContext(), "value");
30 getJspContext().setAttribute("value", value, PageContext.PAGE_SCOPE);
31 final Map fieldErros = (Map) getJspContext().getAttribute(
32 "fieldErrors", PageContext.REQUEST_SCOPE);
33 if (fieldErros.get(getDynamicAttribute().get("name")) != null) {
34 CubbyHelperFunctions.addClassName(getDynamicAttribute(),
35 "fieldError");
36 }
37 JspWriter out = getJspContext().getOut();
38 out.write("<textarea ");
39 out.write(CubbyHelperFunctions.toAttr(getDynamicAttribute()));
40 out.write(">");
41 out.write(CubbyFunctions.out(value));
42 out.write("</textarea>\n");
43 }
44 }