1 10 package org.mmbase.bridge.jsp.taglib; 11 12 import org.mmbase.bridge.jsp.taglib.util.Attribute; 13 import org.mmbase.bridge.jsp.taglib.Condition; 14 import org.mmbase.bridge.NotFoundException; 15 16 import javax.servlet.jsp.JspTagException ; 17 18 19 26 27 public class HasFieldTag extends NodeReferrerTag implements Condition { 28 29 protected Attribute inverse = Attribute.NULL; 30 protected Attribute name = Attribute.NULL; 31 32 public void setInverse(String b) throws JspTagException { 33 inverse = getAttribute(b); 34 } 35 public void setName(String n) throws JspTagException { 36 name = getAttribute(n); 37 } 38 39 40 protected boolean getInverse() throws JspTagException { 41 return inverse.getBoolean(this, false); 42 } 43 44 45 public int doStartTag() throws JspTagException { 46 if (getNode().getNodeManager().hasField(name.getString(this)) != getInverse()) { 47 return EVAL_BODY; 48 } else { 49 return SKIP_BODY; 50 } 51 } 52 public int doAfterBody() throws JspTagException { 53 if (EVAL_BODY == EVAL_BODY_BUFFERED) { try{ 55 if(bodyContent != null) { 56 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 57 } 58 } catch(java.io.IOException e){ 59 throw new JspTagException ("IO Error: " + e.getMessage()); 60 } 61 } 62 return SKIP_BODY; 63 } 64 } 65 | Popular Tags |