You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Donald Ball <db...@rhoworld.com> on 2002/10/28 18:11:56 UTC

sql jstl taglib - accessing to resultset metadata?

When using the sql jstl taglib, is there any way to access the resultset
metadata? I'm looking for a qnd way to get at the column sql types.

- donald


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql jstl taglib - accessing to resultset metadata?

Posted by Shawn Bayern <ba...@essentially.net>.
On Mon, 28 Oct 2002, Henri Yandell wrote:

> Out of interest, I wonder if most of the people who hit this problem
> only want access to the name of the column? And then a smaller group
> simply want the type?
> 
> [not that I recall if jstl offers this or not].

JSTL offers the name but not the type.  (At least, not the "type" in JDBC
terms; you can always get the Java object type with '.class'.)

> Is it possible to offer a subset of the info in the metadata without
> crashing into all the pain?

Sure.  Offering name in JSTL 1.0 seemed like a suitable "inflection
point"; it's possible that more could be offered in the future if it's not
problematic and if there's a compelling reason to.

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql jstl taglib - accessing to resultset metadata?

Posted by Henri Yandell <ba...@generationjava.com>.
Out of interest, I wonder if most of the people who hit this problem only
want access to the name of the column? And then a smaller group simply
want the type?

[not that I recall if jstl offers this or not].

Is it possible to offer a subset of the info in the metadata without
crashing into all the pain?

Hen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql jstl taglib - accessing to resultset metadata?

Posted by Shawn Bayern <ba...@essentially.net>.
On Mon, 28 Oct 2002, Donald Ball wrote:

> In any case, mind a quick question on the way the sql taglib is
> implemented? Is it the case that the code iterates over the ResultSet
> and pulls the data into the Result object before closing the jdbc
> connection? Or does it do something more clever so that the we don't
> have to pay the overhead of touching the data twice?

No, there's pretty much no way to avoid the inefficiency of caching when
the goal is to let page authors avoid having to think about the open
ResultSet or backing database connection.  We chose simplicity over
performance in this case, presuming that in most cases, the overhead
wouldn't be too large except for particularly large data sets.

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql jstl taglib - accessing to resultset metadata?

Posted by Donald Ball <db...@rhoworld.com>.
On 10/28/2002 at 12:18 PM Shawn Bayern wrote:

>On Mon, 28 Oct 2002, Donald Ball wrote:
>
>> When using the sql jstl taglib, is there any way to access the
>> resultset metadata? I'm looking for a qnd way to get at the column sql
>> types.
>
>EA versions of JSTL supported this, but version 1.0 of the specification
>did not, primarily because it wasn't clear that JSTL should be used for
>such advanced applications and because there were some tricky
>implementation issues (concerning, e.g., what should be done with
>exceptions that ResultSetMetaData methods throw).
>
>If you need access to metadata, it's probably best to write your
>database-access code in a servlet.  If you think it would be particularly
>convenient for a future version of JSTL to offer this feature, you could
>send a comment to the official JSTL feedback address at

For my bean-type object stuff, I do all of the SQL interaction in the java
code hidden way behind the scenes. This component of the webapp, however,
is a dataset viewer that interacts with the sql data directly. For this,
the JSTL SQL taglib is a perfect fit; or would be, if I could just get
access to the resultset metadata. I understand the desire to nudge people
away from doing sql in their jsp pages directly, but sometimes it's what's
called for.

In any case, mind a quick question on the way the sql taglib is
implemented? Is it the case that the code iterates over the ResultSet and
pulls the data into the Result object before closing the jdbc connection?
Or does it do something more clever so that the we don't have to pay the
overhead of touching the data twice?

>    jsr-52-comments@jcp.org

Will do, thanks.

- donald


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql jstl taglib - accessing to resultset metadata?

Posted by Shawn Bayern <ba...@essentially.net>.
On Mon, 28 Oct 2002, Donald Ball wrote:

> When using the sql jstl taglib, is there any way to access the
> resultset metadata? I'm looking for a qnd way to get at the column sql
> types.

EA versions of JSTL supported this, but version 1.0 of the specification
did not, primarily because it wasn't clear that JSTL should be used for
such advanced applications and because there were some tricky
implementation issues (concerning, e.g., what should be done with
exceptions that ResultSetMetaData methods throw).

If you need access to metadata, it's probably best to write your
database-access code in a servlet.  If you think it would be particularly
convenient for a future version of JSTL to offer this feature, you could
send a comment to the official JSTL feedback address at

    jsr-52-comments@jcp.org

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>