1 10 package org.mmbase.bridge.jsp.taglib.edit; 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 25 26 public class ValidTag extends ContextReferrerTag implements Condition { 27 28 29 protected Attribute form = Attribute.NULL; 30 protected Attribute inverse = Attribute.NULL; 31 32 public void setForm(String f) throws JspTagException { 33 form = getAttribute(f); 34 } 35 36 public void setInverse(String b) throws JspTagException { 37 inverse = getAttribute(b); 38 } 39 protected boolean getInverse() throws JspTagException { 40 return inverse.getBoolean(this, false); 41 } 42 43 44 public int doStartTag() throws JspTagException { 45 FormTag formTag = (FormTag) findParentTag(FormTag.class, (String ) form.getValue(this), true); 46 if (formTag.isValid() != getInverse()) { 47 return EVAL_BODY; 48 } else { 49 return SKIP_BODY; 50 } 51 } 52 53 public int doAfterBody() throws JspTagException { 54 if (EVAL_BODY == EVAL_BODY_BUFFERED) { if (bodyContent != null) { 56 try{ 57 if(bodyContent != null) { 58 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 59 } 60 } catch(java.io.IOException e){ 61 throw new TaglibException(e); 62 } 63 } 64 } 65 return SKIP_BODY; 66 } 67 } 68 | Popular Tags |