1 29 30 package com.caucho.jsp; 31 32 import com.caucho.el.Expr; 33 import com.caucho.log.Log; 34 35 import javax.servlet.jsp.JspContext ; 36 import javax.servlet.jsp.JspException ; 37 import javax.servlet.jsp.JspWriter ; 38 import javax.servlet.jsp.tagext.JspFragment ; 39 import java.io.Writer ; 40 import java.util.logging.Logger ; 41 42 45 public class ELExprFragment extends JspFragment { 46 private static final Logger log = Log.open(ELExprFragment.class); 47 48 private PageContextImpl _pageContext; 50 51 private Expr _expr; 53 54 57 public ELExprFragment(PageContextImpl pageContext, Expr expr) 58 { 59 _pageContext = pageContext; 60 _expr = expr; 61 } 62 63 66 public JspContext getJspContext() 67 { 68 return _pageContext; 69 } 70 71 77 public void invoke(Writer out) 78 throws JspException 79 { 80 JspWriter oldOut = null; 81 82 if (out != null) 83 oldOut = _pageContext.pushBody(out); 84 85 try { 86 _expr.print(_pageContext.getOut(), _pageContext.getELContext(), false); 87 } catch (RuntimeException e) { 88 throw e; 89 } catch (Exception e) { 90 throw new JspException (e); 91 } finally { 92 if (oldOut != null) 93 _pageContext.setWriter(oldOut); 94 } 95 } 96 } 97 | Popular Tags |