In general, you should put everything you need for the presentation into
a JavaBean, release any other resources, and return just the bean in the
request. This way you also do things like immediately return the
connection to the pool (before anything bad happens). 

As and for an alternative, the Jakarta JDBC tags work great with Struts
too, if you like doing things on the page.

Personally, I use mostly RowSets, which can be disconnected from the
data source as soon as the command completes. The Struts tags don't
support RowSets directly (yet) so I end up pounding the RowSet into a
value object bean and/or an ArrayList for iterate (though a fix for that
is in the works too). 

For more, see Part 2 of Strut by Strut under "Coming Soon" at <
http://www.husted.com/about/struts/ >

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


> Jeff Trent wrote:
> 
> I was wondering how other people deal with physical resource objects
> (eg. db result sets, etc.) during a request.  Before struts, I use to
> allocate the resource, call request.setAttribute() with the resource
> object, call request dispatcher (to do jsp presentation), then clean
> up the resource back in the servlet upon return.  In struts, this has
> all been abstracted out.  Is there an alternative way to manage
> request-scoped resources like this under struts?
> 
> thanks,
> jeff
>

Reply via email to