It looks like you're using an older version (JDBC Tags), I'm using dbtags
which store this value in the pageContext.  You could either switch to
dbtags or possibly add something like the following to your RowCountTag and
recompile and package it:

            StatementTag stmtTag = getStatementTag();
            int rowCount = stmtTag.getTotalRowCount();
            if(rowCount == -1)
                throw new JspTagException("rowCount tag must be used inside
or after a ResultSet tag.");
            //The next line is new
Added--->   pageContext.setAttribute( "rowCount", new Integer(rowCount) );
            pageContext.getOut().write(String.valueOf(rowCount));

Then you could get the row count in your page as:

<% Integer myRowCount = (Integer)pageContext.getAttribute("rowCount"); %>


-----Original Message-----
From: sufi malak [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 12:27 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: can we assign <sql:rowCount/> to a variable ??


Here is the code, but can't see the Contest parameter :

// FrontEnd Plus GUI for JAD
// DeCompiled : RowCountTag.class

package org.apache.taglibs.jdbc.statement;

import java.io.IOException;
import java.io.Writer;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;

// Referenced classes of package org.apache.taglibs.jdbc.statement:
//            StatementTag

public class RowCountTag extends TagSupport
{

    public RowCountTag()
    {
    }

    public int doStartTag()
        throws JspTagException
    {
        try
        {
            StatementTag stmtTag = getStatementTag();
            int rowCount = stmtTag.getTotalRowCount();
            if(rowCount == -1)
                throw new JspTagException("rowCount tag must be used inside 
or after a ResultSet tag.");
            pageContext.getOut().write(String.valueOf(rowCount));
        }
        catch(ClassNotFoundException e)
        {
            throw new JspTagException(e.toString());
        }
        catch(IOException e)
        {
            throw new JspTagException(e.toString());
        }
        return 0;
    }

    private StatementTag getStatementTag()
        throws ClassNotFoundException
    {
        StatementTag statementTag = 
(StatementTag)TagSupport.findAncestorWithClass(this, 
Class.forName("org.apache.taglibs.jdbc.statement.StatementTag"));
        return statementTag;
    }
}


thanks


>From: "Mader, Steve" <[EMAIL PROTECTED]>
>Reply-To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
>To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]>
>Subject: RE: can we assign <sql:rowCount/> to a variable ??
>Date: Wed, 22 May 2002 11:54:01 -0400
>
>
>You'd have to place this code inside or after the ResultSet tags because it
>is dependant on it.  If this does not work, get the source code for your
>version of dbtags and look at the RowCountTag.java program for the
>PageContext parameter name that is used for the row count.
>
>-----Original Message-----
>From: sufi malak [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, May 22, 2002 11:44 AM
>To: [EMAIL PROTECTED]
>Subject: RE: can we assign <sql:rowCount/> to a variable ??
>
>
>I tried it :
><% Integer myRowCount =
>(Integer)pageContext.getAttribute("org.apache.taglibs.dbtags.resultset.rowc
o
>unt");
>%>
><%=myRowCount%>
>
>BUT I got null
>
>
> >From: "Mader, Steve" <[EMAIL PROTECTED]>
> >Reply-To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> >To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]>
> >Subject: RE: can we assign <sql:rowCount/>  to a variable ??
> >Date: Wed, 22 May 2002 10:20:31 -0400
> >
> >
> >Try:
> >
> ><% Integer myRowCount =
>
>(Integer)pageContext.getAttribute("org.apache.taglibs.dbtags.resultset.rowc
>o
> >unt"); %>
> >
> >-----Original Message-----
> >From: sufi malak [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, May 22, 2002 10:08 AM
> >To: [EMAIL PROTECTED]
> >Cc: [EMAIL PROTECTED]
> >Subject: can we assign <sql:rowCount/> to a variable ??
> >
> >
> >can we assign <sql:rowCount/> of DBtag  to a variable ??
> >thanks
> >
> >
> >
> >_________________________________________________________________
> >Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >
>
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to