View Javadoc

1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbTextFieldTag.java,v 1.24 2006/01/13 13:38:51 hkollmann Exp $
3    * $Revision: 1.24 $
4    * $Date: 2006/01/13 13:38:51 $
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;
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 AbstractDbBaseInputTag
40     implements javax.servlet.jsp.tagext.TryCatchFinally {
41     private java.lang.String 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 pwd) {
49        this.password = pwd;
50     }
51  
52  
53     /***
54      * DOCUMENT ME!
55      *
56      * @return DOCUMENT ME!
57      */
58     public String getPassword() {
59        return this.password;
60     }
61  
62  
63     /***
64      * DOCUMENT ME!
65      *
66      * @return DOCUMENT ME!
67      *
68      * @throws javax.servlet.jsp.JspException DOCUMENT ME!
69      * @throws JspException DOCUMENT ME!
70      */
71     public int doEndTag() throws JspException {
72        try {
73           /* Does the developer require the field to be hidden, displayed or displayed as password? */
74           StringBuffer tagBuf = new StringBuffer("<input ");
75  
76           if ("true".equals(this.getPassword())) {
77              tagBuf.append("type=\"password\" ");
78           } else {
79              tagBuf.append(prepareType());
80           }
81  
82           tagBuf.append(prepareName());
83           tagBuf.append(prepareValue());
84           tagBuf.append(prepareSize());
85           tagBuf.append(prepareKeys());
86           tagBuf.append(prepareStyles());
87           tagBuf.append(prepareEventHandlers());
88           tagBuf.append("/>");
89  
90           pageContext.getOut()
91                      .write(tagBuf.toString());
92  
93           // Writes out the old field value
94           writeOutSpecialValues();
95  
96           // For generation Javascript Validation.  Need all original and modified fields name
97           getParentForm()
98              .addChildName(getName(), getFormFieldName());
99        } catch (java.io.IOException ioe) {
100          throw new JspException("IO Error: " + ioe.getMessage());
101       }
102 
103       return EVAL_PAGE;
104    }
105 
106 
107    /***
108     * DOCUMENT ME!
109     */
110    public void doFinally() {
111       password = "false";
112       super.doFinally();
113    }
114 
115 
116    /***
117     * DOCUMENT ME!
118     *
119     * @return DOCUMENT ME!
120     *
121     * @throws javax.servlet.jsp.JspException DOCUMENT ME!
122     */
123    public int doStartTag() throws JspException {
124       super.doStartTag();
125 
126       return SKIP_BODY;
127    }
128 }