1 10 package org.mmbase.bridge.jsp.taglib.pageflow; 11 12 import org.mmbase.bridge.jsp.taglib.util.Attribute; 13 import org.mmbase.bridge.jsp.taglib.*; 14 15 import javax.servlet.jsp.JspTagException ; 16 17 18 24 25 public class PresentTag extends ContextReferrerTag implements Condition { 26 27 protected Attribute inverse = Attribute.NULL; 28 29 public void setInverse(String b) throws JspTagException { 30 inverse = getAttribute(b); 31 } 32 protected boolean getInverse() throws JspTagException { 33 return inverse.getBoolean(this, false); 34 } 35 36 public int doStartTag() throws JspTagException { 37 if ((getContextProvider().getContextContainer().isPresent(getReferid())) != getInverse()) { 38 return EVAL_BODY; 39 } else { 40 return SKIP_BODY; 41 } 42 } 43 44 public int doAfterBody() throws JspTagException { 45 if (EVAL_BODY == EVAL_BODY_BUFFERED) { if (bodyContent != null) { 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 } 55 } 56 return SKIP_BODY; 57 } 58 } 59 | Popular Tags |