Re: [XMLForm] close XMLForm application
Status: Beta
Brought to you by:
ivelin
|
From: Lee P. <bat...@ho...> - 2003-05-14 17:38:42
|
Hi Sylvain,
I have used Castor to marshall an XML file into a series of beans. I wasn't
perhaps completely clear, you could pass the connection object to the
constructor and keep all the data access methods in the bean, but control
the connection object's life outside of the bean, in your case perhaps in a
servlet's init and destroy methods, another approach may be to get the bean
back from XMLFORM using the getModel(id) method and call whatever you need
to.or as the one of the last operations in an action, so for example taking
some code from WizardAction:
else if (formView.equals(VIEW_CONFIRM))
{
if (command.equals(CMD_NEXT))
{
Form.remove(request, FORM_ID);
dBConn.close();
// or
Form form = Form.lookup(request, FORM_ID);
Object model = form.getModel();
model.closeMyConnection();
return VIEW_END;
}
else if (command.equals(CMD_PREV))
return VIEW_SYSTEM;
}
Let me know if you have success with one of these approaches and please post
to the group :)
Lee
----- Original Message -----
From: <Syl...@sw...>
To: <bat...@ho...>
Sent: Wednesday, May 14, 2003 8:36 AM
Subject: RE: [XMLForm] close XMLForm application
Hi Lee,
Thanks for your reply.
For some reasons it is best for me to create a connection to the dB each
time I start an XMLForm application.
You said that we shouldn't add programmatic hooks into the bean.
Where do you put them (for example methods to access to the dB)?
Regards
Sylvain
-----Message d'origine-----
De: Lee Pollington [mailto:bat...@ho...]
Date: mardi, 13. mai 2003 19:40
À: Thévoz Sylvain, IT-DTS-ENG-SDM-DAR;
fre...@li...
Objet: Re: [XMLForm] close XMLForm application
Sylvian,
It would be best if you managed your dB connection outside of the bean.
XMLForm treats your bean purely as a data model, there are no programmatic
hooks into it. If you manage the connection in the Servlet containers
session you can reuse it as well, rather than recreate it per request.
hope that helps,
Lee
----- Original Message -----
From: <Syl...@sw...>
To: <fre...@li...>
Sent: Tuesday, May 13, 2003 2:44 PM
Subject: [XMLForm] close XMLForm application
Hello,
I'm using XMLForm application to retrieve data from a database.
To connect to my database, I'm using an object/relationnal mapping tool
(OJB).
When I start a XMLForm application, I need to initialize the connection to
my database. I'm doing this in the Bean constructor. This is in the Bean
because all data stuffs are in it.
When I close the XMLForm application, I need to close this connection.
My question is: where can I do this in the Bean (or in other place)?
Thanks
Sylvain
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
_______________________________________________
Freebuilder-XMLForm mailing list
Fre...@li...
https://lists.sourceforge.net/lists/listinfo/freebuilder-xmlform
|