1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.dbforms.taglib;
25
26 import java.io.*;
27
28 import javax.servlet.jsp.JspException;
29
30
31
32 /***
33 * Renders an dbforms style tag
34 *
35 * @author Joe Peer
36 */
37 public class TemplateBasedirTag extends AbstractScriptHandlerTag
38 implements javax.servlet.jsp.tagext.TryCatchFinally {
39 private String baseDir;
40
41 /***
42 * DOCUMENT ME!
43 *
44 * @param pageContext DOCUMENT ME!
45 */
46 public void setPageContext(final javax.servlet.jsp.PageContext pageContext) {
47 super.setPageContext(pageContext);
48 this.baseDir = (String) pageContext.getRequest()
49 .getAttribute("baseDir");
50 }
51
52
53 /***
54 * DOCUMENT ME!
55 *
56 * @return DOCUMENT ME!
57 *
58 * @throws JspException DOCUMENT ME!
59 */
60 public int doEndTag() throws JspException {
61 try {
62 StringBuffer buf = new StringBuffer();
63 buf.append(baseDir);
64 pageContext.getOut()
65 .flush();
66 pageContext.getOut()
67 .write(buf.toString());
68 } catch (IOException ioe) {
69 throw new JspException("Problem including template end - "
70 + ioe.toString());
71 }
72
73 return EVAL_PAGE;
74 }
75
76
77 /***
78 * DOCUMENT ME!
79 */
80 public void doFinally() {
81 baseDir = null;
82 }
83
84
85 /***
86 * DOCUMENT ME!
87 *
88 * @return DOCUMENT ME!
89 *
90 * @throws JspException DOCUMENT ME!
91 */
92 public int doStartTag() throws JspException {
93 return SKIP_BODY;
94 }
95 }