1 29 30 package com.caucho.jstl.el; 31 32 import com.caucho.el.Expr; 33 import com.caucho.jsp.PageContextImpl; 34 import com.caucho.util.L10N; 35 36 import javax.servlet.jsp.JspException ; 37 import javax.servlet.jsp.tagext.TagSupport ; 38 39 42 public class IfTag extends TagSupport { 43 private static L10N L = new L10N(IfTag.class); 44 45 private Expr _testExpr; 46 private String _var; 47 private String _scope; 48 49 52 public void setTest(Expr test) 53 { 54 _testExpr = test; 55 } 56 57 60 public void setVar(String var) 61 { 62 _var = var; 63 } 64 65 68 public void setScope(String scope) 69 { 70 _scope = scope; 71 } 72 73 76 public int doStartTag() 77 throws JspException 78 { 79 try { 80 PageContextImpl pageContext = (PageContextImpl) this.pageContext; 81 82 boolean test = _testExpr.evalBoolean(pageContext.getELContext()); 83 Boolean value = test ? Boolean.TRUE : Boolean.FALSE; 84 85 if (_var == null) { 86 } 87 else 88 CoreSetTag.setValue(pageContext, _var, _scope, value); 89 90 return test ? EVAL_BODY_INCLUDE : SKIP_BODY; 91 } catch (Exception e) { 92 throw new JspException (e); 93 } 94 } 95 } 96 | Popular Tags |