tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul DuBois <>
Subject Preferred JSTL idiom to check for NULL values in result set?
Date Thu, 27 Dec 2001 19:20:46 GMT
Is there a preferred (i.e., idiomatic) way to check for a NULL
value in a query result?  Suppose I have the following code:

<sql:query var="rs" dataSource="$conn">

<c:forEach var="row" begin="1" items="$rs.rows">
Local time on the server is
     <c:expr value="$row.get(1)"/>.
The server version is
     <c:expr value="$row.get(2)"/>.
The current user is
     <c:expr value="$row.get(3)"/>.
The current database is
     <c:expr value="$row.get(4)"/>.

If no database currently is selected, DATABASE() may return NULL and
I'd like to print "NONE".  How should I do this?  I looked through the
sql tags part of the JSTL docs to see what it said about testing for
NULL return values, but I didn't find anything.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message