FYI

For those interested in RowSets and unaware of this
implementation, go to Sun's Developer Early Access
page at:

http://developer.java.sun.com/developer/earlyAccess/crs/

Included are three implementations:

1. CachedRowSet -- a rowset that can be used to
  * Send a set of rows across a network
  * Send data to a thin client
  * Add scrollability & updatability to resultset data

2. WebRowSet -- an extension of CachedRowSet that can
be used to send a rowset across a network in XML
format

3. JDBCRowSet -- a rowset that can be used to
encapsulate a JDBC driver as a JavaBeans component


The CachedRowSet and WebRowSet are disconnected
RowSets that do not require a database connection
during their entire lifetime.

John


--- Kris Schneider <[EMAIL PROTECTED]> wrote:
> In addition to rolling your own disconnected storage
> or using the oft-mentioned
> RowSet, here are a couple of other possibilities.
> 
> Check out JSTL's
> javax.servlet.jsp.jstl.sql.ResultSupport class. It
> has a couple
> of utility methods for converting a ResultSet into a
> javax.servlet.jsp.jstl.sql.Result.
> 
> public static Result toResult(ResultSet rs);
> public static Result toResult(ResultSet rs, int
> maxRows);
> 
> The Result interface exposes a handful of properties
> for accessing the data:
> 
> public SortedMap[] getRows();
> public Object[][] getRowsByIndex();
> public String[] getColumnNames();
> public int getRowCount();
> public boolean isLimitedByMaxRows();
> 
> The value returned for a given column is based on
> ResultSet.getObject.
> 
> Another option is to check out the
> org.apache.commons.beanutils.ResultSetDynaClass
> class. This allows you to
> convert a ResultSet into a collection of DynaBean
> instances that represent the
> rows of the ResultSet. Be sure to pay attention to
> the class documentation that
> discusses the linkage to the ResultSet during
> processing. I believe this also
> uses ResultSet.getObject to retrieve column values.
> 
> Quoting David Graham <[EMAIL PROTECTED]>:
> 
> > You got it exactly right Wendy :-).  Your jsp
> should never see a ResultSet 
> > object.  The pattern Wendy is using is very common
> and considered a best 
> > practice.  A ResultSet object maintains a database
> connection throughout its
> > 
> > life so you should only hold onto it long enough
> to populate a collection 
> > with beans.
> > 
> > You'll probably always be using the database but
> you should still use this 
> > pattern.  If you don't you'll have massive
> scalability problems.
> > 
> > David
> > 
> > 
> > 
> > 
> > 
> > 
> > >From: Wendy Smoak <[EMAIL PROTECTED]>
> > >Reply-To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> > >To: 'Struts Users Mailing List'
> <[EMAIL PROTECTED]>
> > >Subject: RE: Iterate through resultset
> > >Date: Thu, 21 Nov 2002 13:55:31 -0700
> > >
> > > > I'm working on this application where I get
> resultsets in jsp pages
> > from
> > > > business objects.
> > >
> > >I do a similar thing, but I have a DAO layer
> return a Collection of Value
> > >Objects.  (How's that for getting a bunch of
> pattern buzzwords into one
> > >sentence?)  The VO's are beans, so I can get at
> the properties with
> > <c:out>
> > >(or <bean:write> I think was the old way).
> > >
> > >The view never sees anything database specific,
> it just gets a Collection
> > >of, say, ResolutionView objects.  (This is a list
> of possible matching
> > >records based on a free-form text name the user
> has entered.  The Action 
> > >has
> > >put the Collection into request scope.)
> > >
> > ><logic-el:iterate id="resView"
> > >                 name="foundPersons"
> > >                
> type="edu.asu.vpia.value.ResolutionView"
> > >                scope="request">
> > >    <c:out value="${resView.key}"/>
> > >    <c:out value="${resView.preferredName}" />
> > >
> > >    <c:set var="addressList"
> value="${resView.preferredAddress}" 
> > >scope="page"
> > >/>
> > >        <logic-el:iterate id="addressLine"
> name="addressList">
> > >          <c:out value="${addressLine}"/>
> > >        </logic-el:iterate>
> > >
> > >    <c:out value="${resView.statusDesc}" />
> > ></logic-el:iterate>
> > >
> > >Maybe one day you will move away from a SQL
> database, and you won't have a
> > >"ResultSet" anymore.  This way, you only have to
> make changes to the layer
> > >of code that provides the Collection and nothing
> in the view is affected.
> > >To the JSP, it's all Strings.
> > >
> > >Take all that for what it's worth... I'm _very_
> new at this.
> > >
> > >--
> > >Wendy Smoak
> > >Applications Systems Analyst, Sr.
> > >Arizona State University PA Information Resources
> Management
> > 
> > 
> >
>
_________________________________________________________________
> > Help STOP SPAM with the new MSN 8 and get 2 months
> FREE*  
> > http://join.msn.com/?page=features/junkmail
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> >
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> -- 
> Kris Schneider <mailto:[EMAIL PROTECTED]>
> D.O.Tech       <http://www.dotech.com/>
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to