1 16 package org.apache.taglibs.dbtags.resultset; 17 18 import java.sql.ResultSet ; 19 import java.sql.SQLException ; 20 21 import javax.servlet.jsp.JspTagException ; 22 import javax.servlet.jsp.tagext.TagSupport ; 23 24 46 public class WasNullTag extends TagSupport { 47 48 private boolean _value = true; 49 50 56 public void setValue(boolean value) { 57 _value = value; 58 } 59 60 66 private ResultSet getResultSet() throws ClassNotFoundException { 67 ResultSetTag rsetTag = 68 (ResultSetTag) findAncestorWithClass(this, Class.forName("org.apache.taglibs.dbtags.resultset.ResultSetTag")); 69 return rsetTag.getResultSet(); 70 } 71 72 public int doStartTag() throws JspTagException { 73 try { 74 ResultSet rset = getResultSet(); 75 boolean wasNull = rset.wasNull(); 76 77 if (wasNull == _value) { 80 return EVAL_BODY_INCLUDE; 81 } else { 82 return SKIP_BODY; 83 } 84 } catch (ClassNotFoundException e) { 85 throw new JspTagException (e.toString()); 86 } catch (SQLException e) { 87 throw new JspTagException (e.toString()); 88 } 89 } 90 91 public void release() { 92 _value = true; 93 } 94 } 95 96 | Popular Tags |