001: /*
002: * (C) Copyright 2004 Nabh Information Systems, Inc.
003: *
004: * All copyright notices regarding Nabh's products MUST remain
005: * intact in the scripts and in the outputted HTML.
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public License
008: * as published by the Free Software Foundation; either version 2.1
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021: package com.nabhinc.portlet.mvcportlet.taglib;
022:
023: import javax.portlet.RenderRequest;
024: import javax.servlet.jsp.JspException;
025: import javax.servlet.jsp.JspWriter;
026:
027: /**
028: * Text area element tag.
029: *
030: * @author Padmanabh Dabke
031: * (c) 2004 Nabh Information Systems, Inc. All Rights Reserved.
032: */
033: public class TextAreaTag extends BaseTag {
034: private String tatCols = null;
035: private String tatRows = null;
036: private String tatValue = null;
037: private String tatScript = null;
038:
039: public void release() {
040: super .release();
041: tatCols = null;
042: tatRows = null;
043: tatValue = null;
044: tatScript = null;
045: }
046:
047: public String getValue() {
048: return tatValue;
049: }
050:
051: public void setValue(String val) {
052: tatValue = val;
053: }
054:
055: public String getCols() {
056: return tatCols;
057: }
058:
059: public void setCols(String cols) {
060: tatCols = cols;
061: }
062:
063: public String getRows() {
064: return tatRows;
065: }
066:
067: public void setRows(String rows) {
068: tatRows = rows;
069: }
070:
071: public String getScript() {
072: return tatScript;
073: }
074:
075: public void setScript(String script) {
076: tatScript = script;
077: }
078:
079: public int doStartTag() throws JspException {
080:
081: try {
082: RenderRequest request = (RenderRequest) pageContext
083: .getRequest().getAttribute("javax.portlet.request");
084: JspWriter out = pageContext.getOut();
085: String fieldValue = null;
086:
087: if (tatValue == null) {
088: fieldValue = getParamValue(request);
089: if (fieldValue == null)
090: fieldValue = "";
091: } else {
092: fieldValue = tatValue;
093: }
094:
095: out.print("<textarea name=\"");
096: out.print(btName);
097: out.print("\" ");
098:
099: if (tatRows != null) {
100: out.print("rows=\"");
101: out.print(tatRows);
102: out.print("\" ");
103: }
104:
105: if (tatCols != null) {
106: out.print("cols=\"");
107: out.print(tatCols);
108: out.print("\" ");
109: }
110:
111: if (btAccesskey != null) {
112: out.print(" accesskey=\"");
113: out.print(btAccesskey);
114: out.print("\"");
115: }
116: if (tabindex != null) {
117: out.print(" tabindex=\"");
118: out.print(tabindex);
119: out.print("\"");
120: }
121: out.print(prepareEventHandlers());
122: out.print(prepareStyles());
123:
124: if (tatScript != null) {
125: out.print(tatScript);
126: out.print(" ");
127: }
128:
129: out.print(">");
130: out.print(fieldValue);
131: out.print("</textarea>");
132: } catch (Exception ex) {
133: throw new JspException(ex);
134: }
135:
136: return SKIP_BODY;
137: }
138:
139: public int doEndTag() {
140: return EVAL_PAGE;
141: }
142:
143: }
|