View Javadoc

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  public class TextareaTag extends DynamicAttributesTagSupport {
14  	
15  	@SuppressWarnings("unchecked")
16  	@Override
17  	public void doTag() throws JspException, IOException {
18  		final Object form = getJspContext().getAttribute("__form", PageContext.REQUEST_SCOPE);
19  		final Object value = CubbyHelperFunctions.formValue2(getDynamicAttribute(), form, getJspContext(), "value");
20  		getJspContext().setAttribute("value", value, PageContext.PAGE_SCOPE);
21  		final Map fieldErros = (Map) getJspContext().getAttribute("fieldErrors", PageContext.REQUEST_SCOPE);
22  		if (fieldErros.get(getDynamicAttribute().get("name")) != null) {
23  			CubbyHelperFunctions.addClassName(getDynamicAttribute(), "fieldError");
24  		}
25  		JspWriter out = getJspContext().getOut();
26  		out.write("<textarea ");
27  		out.write(CubbyHelperFunctions.toAttr(getDynamicAttribute()));
28  		out.write(">");
29  		out.write(CubbyFunctions.out(value));
30  		out.write("</textarea>\n");
31  	}
32  }