tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <j...@wendysmoak.com>
Subject Re: Dynamic Evaluation
Date Thu, 28 Apr 2005 21:46:40 GMT
From: "David Schwartz" <ds@arrayone.com>

> A request attribute is set from a servlet via request.setAttribute.
> The attribute is a ResultSet.
> On the JSP page I want to loop through all request attributes. When I find
one
> that contains the ResultSet I want to output the query results.
>
> Is it possible using JSTL to determine if a request attribute is a
ResultSet?

I don't see why you would need to--  If _you_ called
request.setAttribute(...) then surely you know what name you saved the
ResultSet(s) under.  I think I would set another request attribute with a
List of those names, and iterate over that, not the entire set of request
attributes.   But if you must...

This is a hack since it depends on the output of Class.toString().
(Untested.)

<c:forEach var="item" items="${requestScope}">
    <c:if test="${item.value.class eq 'class some.package.ResultSet'}">
         The key it was saved under: <c:out value="${item.key}"/>
         The ResultSet itself: <c:out value="${item.value}"/>

    </c:if>
</c:forEach>

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message