aspose file tools*
The moose likes Struts and the fly likes DataSource issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DataSource issues" Watch "DataSource issues" New topic
Author

DataSource issues

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
veronique alvaro
Greenhorn

Joined: Sep 05, 2003
Posts: 24
perhaps you should go see this link:
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05525.html
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks, but that is not really the problem I am having.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
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


DBConnection.java
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Never mind. I have figured it out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataSource issues