Are you importing import javax.servlet.ServletContext;
??? Ilya -----Original Message----- From: Fatih Algan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 24, 2002 2:19 PM To: [EMAIL PROTECTED] Subject: Reaching the ServletContext from Action class Hello, I'm a struts newbie, so my question may seem somewhat simple or silly. I'm trying to learn how to use the struts JDBC Connection Pooling facility. Here's what I've done 1.Defined a datasource in struts-config.xml <data-sources> <data-source> <set-property property="driverClass" value="COM.ibm.db2.jdbc.app.DB2Driver"/> <set-property property="url" value="jdbc:db2:struts"/> <set-property property="maxcount" value="5"/> <set-property property="mincount" value="1"/> <set-property property="user" value="db2admin"/> <set-property property="password" value="db2admin"/> </data-source> </data-sources> 2.Created my Action class: 3.Try to reach to SefvletContext from within the action class to get the DataSource object from ServletContext like following; ServletContext context = servlet.getServletContext(); DataSource dataSource = (DataSource) context.getAttribute(Action.DATA_SOURCE_KEY); However the ServletContext is out of the scope of Action class and is not visible. I could not find any methods to get the ServletContext. My questions are; 1.Isn't it weird that the framework does not let me reach the ServletContext? Is there a way to get the ServletContext from within Action class? 2.What is the preffered and best way to get a reference to the DataSource? Thanks in advance... __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.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]>

