Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

DataSource issues

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, but that is not really the problem I am having.
 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind. I have figured it out.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic