KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/TemplateBasedirTag.java,v 1.12 2004/08/18 12:26:09 hkollmann Exp $
3  * $Revision: 1.12 $
4  * $Date: 2004/08/18 12:26:09 $
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 java.io.*;
27
28 import javax.servlet.jsp.JspException JavaDoc;
29
30
31
32 /**
33  * Renders an dbforms style tag
34  *
35  * @author Joe Peer
36  */

37 public class TemplateBasedirTag extends TagSupportWithScriptHandler
38    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
39    private String JavaDoc baseDir;
40
41    /**
42     * DOCUMENT ME!
43     *
44     * @param pageContext DOCUMENT ME!
45     */

46    public void setPageContext(final javax.servlet.jsp.PageContext JavaDoc pageContext) {
47       super.setPageContext(pageContext);
48       this.baseDir = (String JavaDoc) pageContext.getRequest()
49                                          .getAttribute("baseDir");
50    }
51
52
53    /**
54     * DOCUMENT ME!
55     *
56     * @param t DOCUMENT ME!
57     *
58     * @throws Throwable DOCUMENT ME!
59     */

60    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
61       throw t;
62    }
63
64
65    /**
66     * DOCUMENT ME!
67     *
68     * @return DOCUMENT ME!
69     *
70     * @throws JspException DOCUMENT ME!
71     */

72    public int doEndTag() throws JspException JavaDoc {
73       try {
74          StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
75          buf.append(baseDir);
76          pageContext.getOut()
77                     .flush();
78          pageContext.getOut()
79                     .write(buf.toString());
80       } catch (IOException ioe) {
81          throw new JspException JavaDoc("Problem including template end - "
82                                 + ioe.toString());
83       }
84
85       return EVAL_PAGE;
86    }
87
88
89    /**
90     * DOCUMENT ME!
91     */

92    public void doFinally() {
93       baseDir = null;
94    }
95
96
97    /**
98     * DOCUMENT ME!
99     *
100     * @return DOCUMENT ME!
101     *
102     * @throws JspException DOCUMENT ME!
103     */

104    public int doStartTag() throws JspException JavaDoc {
105       return SKIP_BODY;
106    }
107 }
108
Popular Tags