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 | 4 | public class TextareaTag extends DynamicAttributesTagSupport { |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
@SuppressWarnings("unchecked") |
24 | |
@Override |
25 | |
public void doTag() throws JspException, IOException { |
26 | 4 | final Object form = getJspContext().getAttribute("__form", |
27 | |
PageContext.REQUEST_SCOPE); |
28 | 4 | final Object value = CubbyHelperFunctions.formValue( |
29 | |
getDynamicAttribute(), form, getJspContext(), "value"); |
30 | 4 | getJspContext().setAttribute("value", value, PageContext.PAGE_SCOPE); |
31 | 4 | final Map fieldErros = (Map) getJspContext().getAttribute( |
32 | |
"fieldErrors", PageContext.REQUEST_SCOPE); |
33 | 4 | if (fieldErros.get(getDynamicAttribute().get("name")) != null) { |
34 | |
CubbyHelperFunctions.addClassName(getDynamicAttribute(), |
35 | |
"fieldError"); |
36 | |
} |
37 | 4 | JspWriter out = getJspContext().getOut(); |
38 | 4 | out.write("<textarea "); |
39 | 4 | out.write(CubbyHelperFunctions.toAttr(getDynamicAttribute())); |
40 | 4 | out.write(">"); |
41 | 4 | out.write(CubbyFunctions.out(value)); |
42 | 4 | out.write("</textarea>\n"); |
43 | 4 | } |
44 | |
} |