I dont think it is good practice to pass datasource from Action class to your business beans. http://marc.theaimsgroup.com/?l=struts-user&m=104333643909577&w=2 http://marc.theaimsgroup.com/?l=struts-user&m=104182416102397&w=2
I feel using JNDI to get datasource is the best choice. Others - i should have searched the archives properly. i apologize. Thanks ----- Original Message ----- From: "Vic Cekvenich" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 05, 2003 7:44 PM Subject: Re: Design and Datasource question > Some people get a connection in Action, and pass it in many ways to DAO. > > I get a connection in DAO (via DBCP). Ex: > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/basicportal/src/basicWebLib/org /apache/basicWebLib/DAO/BasicDAOImpl.java?rev=1.2&content-type=text/vnd.viewcvs-markup > > .V > > Tolle Krez wrote: > > I am a newbie to struts and started with the struts-example application. And >modified it > > a bit and learning.. . It looks like there are no separate model classes and all business > > logic exists in the Action classes itself. I am thinking of separate them. The Datasource > > settings are in my struts-config file and they are obtained in the Action class >using > > servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY)) . > > > > My question is, if I separate the business logic and database access away from >Action > > classes, how to I do get access to the datasource and connection pool. > > > > PS: I am not using EJB and only plain java classes to access the database and for > > business logics. > > > > Any help is appreciated > > > > T > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]