tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Shead <>
Subject Scope with DBtags
Date Mon, 20 Aug 2001 15:08:17 GMT
I'm running into an odd problem that I think has something to do with the
way scope works within the DBtags.  I need to create a variable to total the
cost for a list of items.  If I create a variable called total outside of
the DBtags, it doesn't seem to be in scope within  the loop that is
generating the rows of my table.  The same thing is happening with int a
that I am trying to use to alternate the bgcolor of my table.

Any suggestions?


Here is the code:

     int a = 0;
     float total = 0; *********************************************

   <sql:resultSet id="rset2">

     total=total+rset2.getFloat("expected_cost"); *** why isn't it in scope
     a = a + 1;
     if(a%2!=0) {%> 
       <tr bgcolor="#FFFFCC"> 
         <% }else {%>
       <tr bgcolor="#CCFFCC"><%}%>
         <td><sql:getColumn colName="description"/></td>
         <td><sql:getColumn colName="vendor"/></td>
         <td><sql:getColumn colName="expected_cost"/></td>
         <td><a href="delete_req_item.jsp?req_item_id=<sql:getColumn
colName="req_item_id"/>">delete </a></td>
      <tr bgcolor="#CCCCFF">
      <td align=RIGHT><b>Total:</b></td>*************** why isn't
it in
scope here?

View raw message