You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeroen Breedveld <je...@x-hive.com> on 2003/10/14 17:23:34 UTC

Help needed using struts with database and sessions

Hi all, 

I'm creating a webapp using struts and a database. The jsp pages access
(for read and write) a resource object in a custom ActionForm like this:

<html:text property="resource.name"/> (causes setName() to be called on
the resource object when submitting form)
<bean:write name="XMLResourceForm" property="resource.owner"/> (causes
getOwner() to called on resource object when jsp is loaded)

All calls to the methods in the resource object need to be called during
a database transaction because the resource object itself accesses the
database to retrieve or set data. I don't want to open and close a
session for every call on the resource object, ideally I want one
session to opened when the jsp loads and several calls are made to the
resource object consecutively. This session would have to be closed as
soon as the jsp is finished loading. And I want a session to be openend
when a form in the jsp is submitted so that new data can be stored in
the database. This session would have to be closed as soon as the jsp is
finished submitting the form data. 

Does anybody has an idea how I can somehow couple the jsp session with
my database session or maybe there is an event-listener that I can use
to start and stop database session when struts is accessing the
ActionForm? Any help is welcome.

Thanks and regards,

Jeroen

--

X-Hive Corporation
e-mail: jeroenb@x-hive.com
phone: +31 10 2818080
http://www.x-hive.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org