1 28 29 package com.caucho.jsp; 30 31 import com.caucho.log.Log; 32 33 import javax.servlet.jsp.JspContext ; 34 import javax.servlet.jsp.JspException ; 35 import javax.servlet.jsp.PageContext ; 36 import javax.servlet.jsp.tagext.JspFragment ; 37 import java.io.Writer ; 38 import java.util.logging.Logger ; 39 40 43 public class StaticJspFragmentSupport extends JspFragment { 44 private static final Logger log = Log.open(StaticJspFragmentSupport.class); 45 46 private String _value; 47 48 private PageContext _pageContext; 49 50 public static StaticJspFragmentSupport create(StaticJspFragmentSupport frag, 51 PageContext pageContext, 52 String value) 53 { 54 if (frag == null) 55 frag = new StaticJspFragmentSupport(); 56 57 frag._value = value; 58 frag._pageContext = pageContext; 59 60 return frag; 61 } 62 63 66 public JspContext getJspContext() 67 { 68 return _pageContext; 69 } 70 71 74 public String getValue() 75 { 76 return _value; 77 } 78 79 85 public void invoke(Writer out) 86 throws JspException 87 { 88 try { 89 if (out == null) 90 _pageContext.getOut().write(_value); 91 else 92 out.write(_value); 93 } catch (RuntimeException e) { 94 throw e; 95 } catch (Exception e) { 96 throw new JspException (e); 97 } 98 } 99 } 100 | Popular Tags |