You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/06/26 19:40:02 UTC
Collection for ResultSet
Subject: Collection for ResultSet
From: "David Chu" <da...@aol.net>
===
What is the preferred method to iterate through the rows of a database query
from a JSP under the Struts framework? Should I write a class that dumps
the contents of a ResultSet into some Collection? It seems this is a
reoccuring problem and would have been tackled before. Please advise on a
preferred solution. Thanks.
--
-david
------------------------------
David C. Chu
America Online
Network Tools Intern
------------------------------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Collection for ResultSet
Posted by Joseph Barefoot <jo...@hereuare.com>.
I'm not sure how everyone else does it, but we always map the contents of a
ResultSet to a Collection of beans to be stored in the request or session
for display by the JSP tags.
peace,
Joe
> -----Original Message-----
> From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
> Sent: Wednesday, June 26, 2002 10:40 AM
> To: struts-user@jakarta.apache.org
> Subject: Collection for ResultSet
>
>
> Subject: Collection for ResultSet
> From: "David Chu" <da...@aol.net>
> ===
> What is the preferred method to iterate through the rows of a
> database query
> from a JSP under the Struts framework? Should I write a class that dumps
> the contents of a ResultSet into some Collection? It seems this is a
> reoccuring problem and would have been tackled before. Please advise on a
> preferred solution. Thanks.
>
>
> --
> -david
>
> ------------------------------
> David C. Chu
> America Online
> Network Tools Intern
> ------------------------------
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: CachedRowSet path for JSP
Posted by slickdev <sl...@comcast.net>.
please disregard my message, written when too tired out.
----- Original Message -----
From: "slickdev" <sl...@comcast.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, June 27, 2002 8:58 PM
Subject: CachedRowSet path for JSP
> I am populating a CachedRowSet object in my action class, then putting it
on
> the session. This seems to work alright, as I can iterate the cached
items
> out to the servlet log.
>
> But, trying to retrieve the CachedRowSet in a jsp with useBean, the path
to
> the class can't be resolved.
>
> <jsp:useBean id="cachedrowset" scope="session" class="sun.jdbc.rowset"/>
>
>
> org.apache.jasper.JasperException: Unable to compile
> C:\dev\Jakarta\Tomcat\work\DEFAULT\freezetrack\test_2.java:289: Class
> sun.jdbc.rowset not found.
> sun.jdbc.rowset cachedrowset = null;
>
> I have tried placing the rowser.jar at various Tomcat locations,
> <tomcat>\lib\apps, <tomcat>\lib\common, <my-app>\web-inf\lib, etc ) but
> nothing works for jsp.
>
> Does anyone know where the rowset.jar must be placed for jsp compilation
to
> resolve the package and classes?
>
>
>
>
> > You can use a CachedRowSet instead of a ResultSet and then just iterate
> > thru that in the JSP
> >
> > Shekhar Jain
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
CachedRowSet path for JSP
Posted by slickdev <sl...@comcast.net>.
I am populating a CachedRowSet object in my action class, then putting it on
the session. This seems to work alright, as I can iterate the cached items
out to the servlet log.
But, trying to retrieve the CachedRowSet in a jsp with useBean, the path to
the class can't be resolved.
<jsp:useBean id="cachedrowset" scope="session" class="sun.jdbc.rowset"/>
org.apache.jasper.JasperException: Unable to compile
C:\dev\Jakarta\Tomcat\work\DEFAULT\freezetrack\test_2.java:289: Class
sun.jdbc.rowset not found.
sun.jdbc.rowset cachedrowset = null;
I have tried placing the rowser.jar at various Tomcat locations,
<tomcat>\lib\apps, <tomcat>\lib\common, <my-app>\web-inf\lib, etc ) but
nothing works for jsp.
Does anyone know where the rowset.jar must be placed for jsp compilation to
resolve the package and classes?
> You can use a CachedRowSet instead of a ResultSet and then just iterate
> thru that in the JSP
>
> Shekhar Jain
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Collection for ResultSet
Posted by Ted Husted <hu...@apache.org>.
Joseph Barefoot wrote:
> Good point. Woudn't this require more logic in the JSP to retrieve values
> from the CachedRowSet though? I mean, won't you have to write code like <%
> int displayValue = getInt(n++); %> in order to retrieve values?
I wrote an iterator wrapper for a CachedRowSet once. Seemed to work
pretty good. Its on the ResourcePage under ValueIterator.
http://jakarta.apache.org/struts/resources/extensions.html
There's also some utilities in the scaffold toolkit that can be used to
turn a ResultSet into a collection of beans via reflection. Just need to
pass it an instance of one of the beans with properties that match the
column names. It hasn't been tested with very many DBMS's, but is known
to work fine with MySQL and some others.
The codebase in the contrib folder is still out of date. The best public
version is in this pre-release of the Artimus example application. After
I finish some more 1.1 retrowork, I'll update the contrib, and maybe
move most of scaffold to the Commons.
http://husted.com/struts/resources/artimus.zip
See the ResulSetUtils and the StatementUtils in the scaffold.sql
package.
-- Ted Husted, Husted dot Com, Fairport NY US
-- Java Web Development with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Collection for ResultSet
Posted by Joseph Barefoot <jo...@hereuare.com>.
Good point. Woudn't this require more logic in the JSP to retrieve values
from the CachedRowSet though? I mean, won't you have to write code like <%
int displayValue = getInt(n++); %> in order to retrieve values?
peace,
Joe
> -----Original Message-----
> From: Shekhar Jain [mailto:shekhar@edgesoftinc.com]
> Sent: Wednesday, June 26, 2002 11:07 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Collection for ResultSet
>
>
> You can use a CachedRowSet instead of a ResultSet and then just iterate
> thru that in the JSP
>
> Shekhar Jain
>
> -----Original Message-----
> From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
> Sent: Wednesday, June 26, 2002 10:40 AM
> To: struts-user@jakarta.apache.org
> Subject: Collection for ResultSet
>
>
> Subject: Collection for ResultSet
> From: "David Chu" <da...@aol.net>
> ===
> What is the preferred method to iterate through the rows of a database
> query from a JSP under the Struts framework? Should I write a class
> that dumps the contents of a ResultSet into some Collection? It seems
> this is a reoccuring problem and would have been tackled before. Please
> advise on a preferred solution. Thanks.
>
>
> --
> -david
>
> ------------------------------
> David C. Chu
> America Online
> Network Tools Intern
> ------------------------------
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Collection for ResultSet
Posted by Shekhar Jain <sh...@edgesoftinc.com>.
You can use a CachedRowSet instead of a ResultSet and then just iterate
thru that in the JSP
Shekhar Jain
-----Original Message-----
From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
Sent: Wednesday, June 26, 2002 10:40 AM
To: struts-user@jakarta.apache.org
Subject: Collection for ResultSet
Subject: Collection for ResultSet
From: "David Chu" <da...@aol.net>
===
What is the preferred method to iterate through the rows of a database
query from a JSP under the Struts framework? Should I write a class
that dumps the contents of a ResultSet into some Collection? It seems
this is a reoccuring problem and would have been tackled before. Please
advise on a preferred solution. Thanks.
--
-david
------------------------------
David C. Chu
America Online
Network Tools Intern
------------------------------
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>