KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbLinkPositionItemTag.java,v 1.13 2004/08/18 12:26:07 hkollmann Exp $
3  * $Revision: 1.13 $
4  * $Date: 2004/08/18 12:26:07 $
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.config.*;
27
28 import javax.servlet.jsp.*;
29
30
31
32 /**
33  * to be embedded inside a linkURL-element, as shown in example below:
34  * &lt;linkURL HREF="customer.jsp" table="customer" /&gt; &lt;position
35  * fieldName="id" value="103" /&gt; &lt;position fieldName="cust_lang"
36  * value="2" /&gt; &lt;/link&gt;
37  */

38 public class DbLinkPositionItemTag extends DbBaseHandlerTag
39    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
40    String JavaDoc value;
41
42    /**
43     * DOCUMENT ME!
44     *
45     * @param string
46     */

47    public void setValue(String JavaDoc string) {
48       value = string;
49    }
50
51
52    /**
53     * DOCUMENT ME!
54     *
55     * @return
56     */

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

65    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
66       throw t;
67    }
68
69
70    /**
71     * DOCUMENT ME!
72     */

73    public void doFinally() {
74       value = null;
75       super.doFinally();
76    }
77
78
79    /**
80     * Set up the tag with parent tag's table and link to the field. Then add
81     * the data to the enclosing linkURL tag.
82     *
83     * @return DOCUMENT ME!
84     *
85     * @throws JspException thrown when error occurs in processing the body of
86     * this method
87     */

88    public int doStartTag() throws JspException {
89       DbLinkURLTag parentTag = null;
90
91       try {
92          parentTag = (DbLinkURLTag) this.getParent();
93       } catch (Exception JavaDoc e) {
94          throw new JspException("DbLinkPositionItem-element must be placed inside a DbLinkURL-element!");
95       }
96
97       Table table = parentTag.getTable();
98       Field field = table.getFieldByName(getName());
99       parentTag.addPositionPart(field, getValue());
100
101       return EVAL_BODY_INCLUDE;
102    }
103 }
104
Popular Tags