1 23 24 package org.dbforms.taglib; 25 26 import org.dbforms.util.PageContextBuffer; 27 28 import javax.servlet.Servlet ; 29 import javax.servlet.jsp.JspException ; 30 import javax.servlet.jsp.PageContext ; 31 import javax.servlet.jsp.tagext.BodyTagSupport ; 32 import javax.servlet.jsp.tagext.Tag ; 33 34 35 36 42 public class DbBaseHandlerFactory { 43 private DbBaseHandlerTag tag; 44 private PageContextBuffer pageContext; 45 46 55 public DbBaseHandlerFactory(PageContext parentContext, 56 BodyTagSupport parent, 57 Class clazz) throws JspException { 58 try { 59 tag = (DbBaseHandlerTag) clazz.newInstance(); 60 pageContext = new PageContextBuffer(); 61 pageContext.initialize((Servlet ) parentContext.getPage(), 62 parentContext.getRequest(), 63 parentContext.getResponse(), null, true, 0, true); 64 tag.setPageContext(pageContext); 65 tag.setParent(parent); 66 } catch (Exception e) { 67 throw new JspException (e); 68 } 69 } 70 71 76 public DbBaseHandlerTag getTag() { 77 return tag; 78 } 79 80 81 88 public StringBuffer render() throws JspException { 89 if (tag.doStartTag() != Tag.SKIP_BODY) { 90 tag.doEndTag(); 91 } 92 93 return pageContext.getBuffer(); 94 } 95 } 96 | Popular Tags |