1 10 package org.mmbase.bridge.jsp.taglib.functions; 11 12 import javax.servlet.jsp.JspTagException ; 13 14 import org.mmbase.bridge.jsp.taglib.*; 15 import org.mmbase.bridge.jsp.taglib.containers.FunctionContainerReferrer; 16 import org.mmbase.bridge.jsp.taglib.util.Attribute; 17 import org.mmbase.util.Casting; 18 19 27 public class BooleanFunctionTag extends AbstractFunctionTag implements Condition, FunctionContainerReferrer { 28 29 protected Attribute inverse = Attribute.NULL; 30 31 public void setInverse(String b) throws JspTagException { 32 inverse = getAttribute(b); 33 } 34 35 protected boolean getInverse() throws JspTagException { 36 return inverse.getBoolean(this, false); 37 } 38 39 public int doStartTag() throws JspTagException { 40 Object value = getFunctionValue(); 41 boolean booleanValue = Casting.toBoolean(value); 42 return (booleanValue != getInverse()) ? EVAL_BODY_BUFFERED : SKIP_BODY; 43 } 44 45 46 public int doAfterBody() throws JspTagException { 47 try{ 48 if(bodyContent != null) { 49 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 50 } 51 } catch(java.io.IOException e){ 52 throw new TaglibException(e); 53 } 54 return EVAL_PAGE; 55 } 56 57 58 } 59 | Popular Tags |