On Sun, 8 Sep 2002, Gisella Saavedra wrote:

> is there a way to find out the data type (metadata) of the columns
> retrieved thru a query?
> 
> I am transferring the "var" that comes back filled from a <sql:query >
> to another JSP page.  I want to format the data depending on whether
> they are date columns, or text, or numbers??

This isn't possible in JSTL 1.0.  We considered the feature, but it
presented some tricky technical issue (how to deal with errors retrieving
the metadata, for one), and we dropped it for JSTL 1.0.

An application that needs this information might be straining itself to
use JSTL for database access anyway.  If you'd like to use JSTL instead of
a servlet (or other Java-based component) to access your data, though, you
can likely use the <fmt:parseDate> and <fmt:parseNumber> tags in
conjunction with <c:catch> to "guess" whether the information is a date, a
number, or arbitrary text.  Note, however, that this logic will base
itself on the form of the data, not on its column's type.

Hope that helps,

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


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

Reply via email to