View Javadoc

1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/PropertyTag.java,v 1.4 2006/01/25 16:35:23 hkollmann Exp $
3    * $Revision: 1.4 $
4    * $Date: 2006/01/25 16:35:23 $
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 org.dbforms.interfaces.IAddProperty;
27  
28  import javax.servlet.jsp.JspException;
29  
30  
31  /*** 
32   * Tag &lt;attribute&gt; which defines a key/value pair which is set in the parent
33   * tag. This must implement the Parameterized interface.
34   * @see IAddProperty
35   * @author  Henner Kollmann 
36   */
37  public class PropertyTag extends AbstractDbBaseHandlerTag
38  	implements javax.servlet.jsp.tagext.TryCatchFinally {
39  
40      private String name;
41      private String value;
42  
43      public int doStartTag() throws JspException {
44          if ((getParent() != null)
45                    && getParent() instanceof IAddProperty) {
46             ((IAddProperty) getParent()).addProperty(name, value);
47             } else {
48             throw new JspException("AttributeTag element must be placed inside a IParameterized element!");
49          }
50          return SKIP_BODY;
51       }
52  
53      public void setName(String name) {
54          this.name = name;
55      }
56  
57      public void setValue(String val) {
58          this.value = val;
59      }
60  
61      
62      /***
63       * @see javax.servlet.jsp.tagext.TryCatchFinally#doFinally(java.lang.Throwable)
64       */
65      public void doFinally() {
66      	name   = null;
67         value = null;
68         super.doFinally();
69      }
70  
71  
72  }