Hi Caroline,
The return address on the private email you sent me turned out to be my own address, so, since it's of fairly general interest, I'm pasting it below. Normally I'd put it in the
Struts forum, but it's kind of connected to what you just asked, and I figured that you'd be more likely to see it here.
I'm out of practice on Struts Datasources, though I hope that before the week's out I'll be working on a project that uses them again. The original source code can be found under the "Get the code" hyperlink on the upper-right corner of the online version of the article at:
http://www.fawcette.com/javapro/2002_04/magazine/features/tholloway/ The demo site (which got eaten by the Slapper worm) was the identical code except that I'd put in footnotes at the bottom of each web page that displayed the source code for the Action Procedures,
JSP's and the xonfig files.
The actual connection pool is defined at the top of the struts-config.xml file. The action processors call the FormBean load() and save() method to handle persistence (some people thing that persistence should be part of the Action processor itself, but I was thinking in
EJB terms). The Form Bean load() and save() methods invoke the servlet.findDataSource() method to acquire a Connection from the connection pool.
A more recent project I did uses EJBs and the
JBoss appserver. In this case, the EJBs and security system are also invoking
JDBC. I think JBoss has its own connection pool management, so the struts-config.xml connection pool feature wasn't used, but I had to subclass the Struts ActionServlet in order to make the JBoss connection pool serve as a Struts connection pool. It wasn't hard, though I can't give any examples, since the machine with the source code for that project is currently offline. If you need it, let me know and I'll send a copy, though it might take about a week to get it.
Good luck!
Tim Holloway