Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

getDataSource  RSS feed

Ranch Hand
Posts: 111
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't understant why the following code doesnt compile on the getDataSourceLine. Eclipse says that the method getDataSource is undefined for the type LoginAction

Im using struts 1.3.8

Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Intially I was using DataSource configuration utility,but it resulted nothing else than errors,

Merrill suggested in this manner

Don't use Struts DataSource configuration utility. It's deprecated in later versions, so it would make your application more difficult to upgrade. It also has portability issues. I've seen instances where it worked fine in development, but didn't work when the application was ported to production.

The best practice for connecting to a JDBC DataSource in a Struts or any J2EE Web Application is to define the DataSource as a JNDI resource using your Application Server's preferred method and then using JNDI to look up the DataSource in your application code. If you're using Tomcat, this link explains how to do it.

Also see question 7 in the JavaRanch Struts FAQ.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!