1 23 24 package org.dbforms.taglib; 25 26 import java.io.*; 27 28 import javax.servlet.jsp.JspException ; 29 30 31 32 37 public class TemplateBasedirTag extends TagSupportWithScriptHandler 38 implements javax.servlet.jsp.tagext.TryCatchFinally { 39 private String baseDir; 40 41 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 60 public void doCatch(Throwable t) throws Throwable { 61 throw t; 62 } 63 64 65 72 public int doEndTag() throws JspException { 73 try { 74 StringBuffer buf = new StringBuffer (); 75 buf.append(baseDir); 76 pageContext.getOut() 77 .flush(); 78 pageContext.getOut() 79 .write(buf.toString()); 80 } catch (IOException ioe) { 81 throw new JspException ("Problem including template end - " 82 + ioe.toString()); 83 } 84 85 return EVAL_PAGE; 86 } 87 88 89 92 public void doFinally() { 93 baseDir = null; 94 } 95 96 97 104 public int doStartTag() throws JspException { 105 return SKIP_BODY; 106 } 107 } 108 | Popular Tags |