Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access Datasource Tag (struts-config.xml) in POJO

 
Neha k Agrawal
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
I am doing a project in struts.I have stored the database connection information in data-source tag of struts-config.xml file.This is the code.



Now I want to access this data in POJO.I know how to use it in action class but unable to use it in POJO.To access it in action class , the code goes like this....



Can anyone tell me what to do?.Any help will be highly appreciated.Thank you in advance.
 
Praveen Sangolli
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Neha,

I am not sure whether this might help you, it sounds silly...
Have you tried sending DataSource as a parameter to a method in your POJO.
By doing so you will have a handle to the datasourse and then you can get hold of the connection object..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic