KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbHeaderTag.java,v 1.11 2004/08/18 12:26:07 hkollmann Exp $
3  * $Revision: 1.11 $
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 javax.servlet.jsp.*;
27
28
29
30 /**
31  * this tag renders a Header-tag. it is supposed to be nested within a
32  * DbFormTag. because this tag is nested within a DbFormTag it is invoked
33  * every time the parent dbFormTag gets evaluated, but it gets only rendered
34  * at the FIRST evalation-loop.
35  *
36  * @author Joachim Peer
37  */

38 public class DbHeaderTag extends DbBaseHandlerTag {
39    /**
40     * DOCUMENT ME!
41     *
42     * @return DOCUMENT ME!
43     *
44     * @throws JspException DOCUMENT ME!
45     */

46    public int doAfterBody() throws JspException {
47       return SKIP_BODY;
48    }
49
50
51    /**
52     * DOCUMENT ME!
53     *
54     * @return DOCUMENT ME!
55     *
56     * @throws JspException DOCUMENT ME!
57     */

58    public int doEndTag() throws JspException {
59       try {
60          if (bodyContent != null) {
61             bodyContent.writeOut(bodyContent.getEnclosingWriter());
62             bodyContent.clearBody(); // 2002116-HKK: workaround for duplicate rows in Tomcat 4.1
63
}
64       } catch (java.io.IOException JavaDoc e) {
65          throw new JspException("IO Error: " + e.getMessage());
66       }
67
68       return EVAL_PAGE;
69    }
70
71
72    /**
73     * DOCUMENT ME!
74     *
75     * @return DOCUMENT ME!
76     */

77    public int doStartTag() {
78       if (getParentForm()
79                    .getCurrentCount() == 0) {
80          return EVAL_BODY_BUFFERED;
81       } else {
82          return SKIP_BODY;
83       }
84    }
85 }
86
Popular Tags