Hi,
The "getDataSource" method is only available in the Action class of the struts framework. Please see
http://jakarta.apache.org/struts/api...on/Action.html
for more info. It seems as if getting the DataSource is confined within this particular class. I am trying to get the DataSource within a DAO and Servlet, but to no avail. Perhaps a look at the source for this class might shed some light on how to do this.
For the time being, I suggest adding a <Resource> within the <Context> of the webapp your are using in the /CATALINA_HOME/conf/server.xml, then use:
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:comp/env");
DataSource ds = (DataSource)envContext.lookup("YOUR_JNDI_DATASOURC E_NAME HERE ");
It worked for me.