1 16 package org.apache.taglibs.utility.lang; 17 18 import java.io.IOException ; 19 import javax.servlet.jsp.*; 20 import javax.servlet.jsp.tagext.*; 21 22 27 28 public class IfTag extends BodyTagSupport { 29 30 private boolean predicate = false; 31 32 public boolean getPredicate() { 33 return predicate; 34 } 35 36 public void setPredicate(boolean val) { 37 this.predicate = val; 38 } 39 40 public int doStartTag() { 41 if (getPredicate()) return EVAL_BODY_TAG; 42 else return SKIP_BODY; 43 } 44 45 public int doAfterBody() throws JspException { 46 try { 47 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 48 return SKIP_BODY; 49 } catch (IOException ex) { 50 throw new JspTagException(ex.toString()); 51 } 52 } 53 54 } 55 | Popular Tags |