Ok, before I started converting my web app to STRUTS, I used a DataSource to do connection pooling. I had an XML file with the same name as my web app in the webapps folder of Tomcat. I did the Context.lookup for the JNDI name and all worked well. Now that I am using STRUTS, this file no longer works for me. It tell me "name jdbc not bound in this context". So I then tried to use struts-config.xml's datasource element, but I couldn't get it to work either. I kept getting a nullpointerexception when I tried to just load the login page. After some research on google, I found that error to be caused by a problem with the datasource setup. But I didn't see any errors in it. So my question is not how to get what I am doing working, but rather, how should I be utalizing a DataSource and Connection Pooling in STRUTS 1.1. Thanks.
Hi, Gregg, I am working on the same thing. I use Tomcat. My connection pool had worked fine (see the code below) before I started experimenting with Struts. Even though Struts has the connection pool feature, I am advised to use the connection pool provided by the server. I want to keep the business logic (user authentication against database) out of the LogonAction class. In the LogonAction, I have a "boolean validated" to INDICATE if the username entered by a visitor can be found in the database and the password entered by that visitor matches what is in the database. I am having a difficult time to pass HttpServletRequest and the result of the authentication back and forth between LogonAction and the business logic class. You seem to be ahead of me and have figured something out. Would you share what you have done? Here are my codes of the servlet that uses a helper class. The DataSource and JNDI are in the helper class: VerificationServlet.java
Joined: Nov 19, 2000
Never mind. I have figured it out.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com