org.apache.taglibs.dbtags.resultset
Class ResultSetTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.taglibs.dbtags.resultset.ResultSetTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag

public class ResultSetTag
extends javax.servlet.jsp.tagext.BodyTagSupport

JSP tag resultSet, executes the query and loops through the results for the enclosing statement or preparedstatement tag. The body of this tag is executed once per row in the resultset. The optional "loop" attribute, which default to true, specifies whether to execute the tag body once per row "true", or to simply assign the ResultSet to the page attribute specified by "id". The optional "name" and "scope" attributes can be used to retrieve a resultset (or rowset) from context.

JSP Tag Lib Descriptor

 <name>resultSet</name>
 <tagclass>org.apache.taglibs.dbtags.resultset.ResultSetTag</tagclass>
 <teiclass>org.apache.taglibs.dbtags.connection.ResultSetTEI</teiclass>
 <bodycontent>JSP</bodycontent>
 <info>JSP tag resulset, executes the query and loops through the results
 for the enclosing statement or preparedstatement tag.  The body of
 this tag is executed once per row in the resultset.  The optional
 "loop" attribute, which default to true, specifies whether to execute
 the tag body once per row "true", or to simply assign the ResultSet
 to the page attribute specified by "id". The optional "name" and "scope"
 attributes can be used to retrieve a resultset (or rowset) from context.<</info>
   <attribute>
     <name>id</name>
     <required>true</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>loop</name>
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
   <attribute>
     <name>name</name>
     <required>false</required>
     <rtexprvalue>true</rtexprvalue>
   </attribute>
   <attribute>
     <name>scope</name>
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>
   </attribute>
 

Author:
Morgan Delagrange, Ted Husted, Craig McClanahan
See Also:
StatementImplTag, QueryTag, PreparedStatementImplTag, Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ResultSetTag()
           
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 int doStartTag()
           
 java.sql.ResultSet getResultSet()
           
protected  java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String scope)
          Locate and return the specified bean, from an optionally specified scope, in the specified page context.
 void release()
           
 void setLoop(boolean shouldLoop)
           
 void setName(java.lang.String name)
          Name of the bean that contains the rowset to process.
 void setScope(java.lang.String scope)
           
protected  void setTotalRowCount(int rowCount)
           
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

ResultSetTag

public ResultSetTag()
Method Detail

lookup

protected java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext,
                                  java.lang.String name,
                                  java.lang.String scope)
                           throws javax.servlet.jsp.JspTagException
Locate and return the specified bean, from an optionally specified scope, in the specified page context. If no such bean is found, return null instead. If an exception is thrown, it will have already been saved via a call to saveException().

Parameters:
pageContext - Page context to be searched
name - Name of the bean to be retrieved
scope - Scope to be searched (page, request, session, application) or null to use findAttribute() instead
Throws:
JspException - if an invalid scope name is requested
javax.servlet.jsp.JspTagException

setName

public void setName(java.lang.String name)
Name of the bean that contains the rowset to process.


setScope

public void setScope(java.lang.String scope)

setLoop

public void setLoop(boolean shouldLoop)

getResultSet

public java.sql.ResultSet getResultSet()

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspTagException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspTagException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspTagException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspTagException

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspTagException
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspTagException

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport

setTotalRowCount

protected void setTotalRowCount(int rowCount)


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.