[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: May be [OT] ForEach Tag with expression returned fields.



You can either alias the second field with a name:
    Select ReportProfile,Count(*) CountOf From Main_Database Group By ReportProfile;
and pick up the field by the alias name (of CountOf) in your JSP or if you had a resultset object, you could use a metadata name for that field or a numeric reference index out of the resultset. 
 
Hope it helps.
-----Original Message-----
From: Bill Woodson [mailto:radman@usefulware.com]
Sent: Wednesday, December 04, 2002 11:35 AM
To: List AJUG
Subject: May be [OT] ForEach Tag with expression returned fields.

Hi All,
 
I apologize if this is off topic, it does deal with a facet of Java, so here it goes.  I am trying to write a JSP that is a report from a database. The Query looks like this:
    Select ReportProfile,Count(*) From Main_Database Group By ReportProfile;
 
I don't know how to print the second field which is the result of the Count function.  In other words my code looks something like this
    <c:forEach var="row" items="${resultQuery.rows}" >
        <tr>
        <td><c:out value="${row.ReportProfile}" /></td>
        <td><c:out value="${???What goes here????}" /></td> 
        </tr>
    </c:forEach>
 
MS SQL Server uses an AS keyword for aliasing the field, but that apparently is not proper in The java implementation.
 
Any help would be greatful, Thanks.
Bill