• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DataSource issues

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
veronique alvaro
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
perhaps you should go see this link:
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05525.html
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but that is not really the problem I am having.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind. I have figured it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic