File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes getDataSource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getDataSource" Watch "getDataSource" New topic
Author

getDataSource

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 102

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

Thanks
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
HI,

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getDataSource
 
Similar Threads
confusing compile error
Struts Login/Logout Form
Thread safe Struts Action
Help in connecting to oracle10 database using struts
Problem in Struts Application while connecting to database