1 2 17 package org.apache.taglibs.dbtags.resultset; 18 19 import javax.servlet.jsp.JspTagException ; 20 import javax.servlet.jsp.tagext.TagSupport ; 21 22 46 public class WasEmptyTag extends TagSupport { 47 48 private boolean _value = true; 49 50 56 public void setValue(boolean value) { 57 _value = value; 58 } 59 60 public int doStartTag() throws JspTagException { 61 62 Integer integer = 63 (Integer ) pageContext.getAttribute("org.apache.taglibs.dbtags.resultset.rowcount"); 64 65 if (integer == null) { 66 throw new JspTagException ("WasEmpty and WasNotEmpty tags must follow a ResultSet tag."); 67 } 68 69 int rowCount = integer.intValue(); 70 71 boolean wasEmpty = true; 72 if (rowCount > 0) { 73 wasEmpty = false; 74 } 75 76 if (wasEmpty == _value) { 79 return EVAL_BODY_INCLUDE; 80 } else { 81 return SKIP_BODY; 82 } 83 } 84 85 public void release() { 86 _value = true; 87 } 88 } 89 90 | Popular Tags |