Some days ago, Antony made a question and now I'm having the same problem, can some one explain to me if there is a way to access to the datasource configured in the struts-config file from a class that doesn't extend an action?
Thanks in advance Javier > -----Mensaje original----- > De: Antony Stace [mailto:[EMAIL PROTECTED]] > Enviado el: miercoles 30 de enero de 2002 5:36 > Para: [EMAIL PROTECTED] > Asunto: Accessing database defined in struts-config > > > Hi > > I have an initialisation servlet which is run when my web app start up. > > public class WebAppInit extends HttpServlet > { > public void init() > { > > } > > } > > All it does is to set some application wide beans. I need to be able to > access the database I have defined in my struts-config.xml file > in this initalisation servlet. I > can access this database from my Action classes via > > public final class Logon extends Action > { > > public ActionForward perform(ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) > throws IOException, ServletException > { > DataSource dataSource = servlet.findDataSource("testDataBase"); > > } > } > > > since this class extents Action but do not know how to access > this database > via the WebAppInit class. How can I access the database from the > WebAppInit class. > > > > -- > > > Cheers > > Tony > --------------------------------------------------------------------- > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>