1 16 17 package org.apache.taglibs.standard.tag.el.core; 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.JspTagException ; 21 import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 22 23 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 24 import org.apache.taglibs.standard.tag.common.core.NullAttributeException; 25 26 34 35 public class IfTag extends ConditionalTagSupport { 36 37 40 public IfTag() { 42 super(); 43 init(); 44 } 45 46 public void release() { 48 super.release(); 49 init(); 50 } 51 52 53 56 protected boolean condition() throws JspTagException { 57 try { 58 Object r = ExpressionEvaluatorManager.evaluate( 59 "test", test, Boolean .class, this, pageContext); 60 if (r == null) 61 throw new NullAttributeException("if", "test"); 62 else 63 return (((Boolean ) r).booleanValue()); 64 } catch (JspException ex) { 65 throw new JspTagException (ex.toString(), ex); 66 } 67 } 68 69 70 73 private String test; 75 76 79 public void setTest(String test) { 81 this.test = test; 82 } 83 84 85 88 private void init() { 90 test = null; 91 } 92 } 93 | Popular Tags |