KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > taglib > DbTextFieldTag


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbTextFieldTag.java,v 1.22 2004/08/18 12:26:08 hkollmann Exp $
3  * $Revision: 1.22 $
4  * $Date: 2004/08/18 12:26:08 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

23
24 package org.dbforms.taglib;
25
26 import javax.servlet.jsp.JspException JavaDoc;
27
28
29
30 /**
31  * <p>
32  * This tag renders a HTML TextArea - Element
33  * </p>
34  * this tag renders a dabase-datadriven textArea, which is an active element -
35  * the user can change data
36  *
37  * @author Joachim Peer
38  */

39 public class DbTextFieldTag extends DbBaseInputTag
40    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
41    private java.lang.String JavaDoc password = "false";
42
43    /**
44     * Determines if the text field should be a password text field (display '')
45     *
46     * @param pwd DOCUMENT ME!
47     */

48    public void setPassword(String JavaDoc pwd) {
49       this.password = pwd;
50    }
51
52
53    /**
54     * DOCUMENT ME!
55     *
56     * @return DOCUMENT ME!
57     */

58    public String JavaDoc getPassword() {
59       return this.password;
60    }
61
62
63    /**
64     * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable)
65     */

66    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
67       throw t;
68    }
69
70
71    /**
72     * DOCUMENT ME!
73     *
74     * @return DOCUMENT ME!
75     *
76     * @throws javax.servlet.jsp.JspException DOCUMENT ME!
77     * @throws JspException DOCUMENT ME!
78     */

79    public int doEndTag() throws JspException JavaDoc {
80       try {
81          /* Does the developer require the field to be hidden, displayed or displayed as password? */
82          StringBuffer JavaDoc tagBuf = new StringBuffer JavaDoc("<input ");
83
84          if ("true".equals(this.getPassword())) {
85             tagBuf.append("type=\"password\" ");
86          } else {
87             tagBuf.append(prepareType());
88          }
89
90          tagBuf.append(prepareName());
91          tagBuf.append(prepareValue());
92          tagBuf.append(prepareSize());
93          tagBuf.append(prepareKeys());
94          tagBuf.append(prepareStyles());
95          tagBuf.append(prepareEventHandlers());
96          tagBuf.append("/>");
97
98          pageContext.getOut()
99                     .write(tagBuf.toString());
100
101          // Writes out the old field value
102
writeOutSpecialValues();
103
104          // For generation Javascript Validation. Need all original and modified fields name
105
getParentForm()
106             .addChildName(getName(), getFormFieldName());
107       } catch (java.io.IOException JavaDoc ioe) {
108          throw new JspException JavaDoc("IO Error: " + ioe.getMessage());
109       }
110
111       return EVAL_PAGE;
112    }
113
114
115    /**
116     * DOCUMENT ME!
117     */

118    public void doFinally() {
119       password = "false";
120       super.doFinally();
121    }
122
123
124    /**
125     * DOCUMENT ME!
126     *
127     * @return DOCUMENT ME!
128     *
129     * @throws javax.servlet.jsp.JspException DOCUMENT ME!
130     */

131    public int doStartTag() throws JspException JavaDoc {
132       super.doStartTag();
133
134       return SKIP_BODY;
135    }
136 }
137
Popular Tags