This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello every one, I have a query. Can anyone tell me if it's a good idea to put JDBC code in the Action class or it'll be better to put it in a different POJ class. Any answers will be highly appriciated. Regards, Varun Narang.
Your computer system is like AC, it's of no use when you open Windows ;)
Varun, It's better not to have JDBC in the Action class for the same reason it is better not to have it in a Servlet. In general, you want to keep your web layer and database layer in different classes. This makes it easier to change them independently of each other.
I agree with Jeanne. One of the main reasons for using Struts is to assist you in following the Model/View/Controller (MVC) pattern. An Action class belongs in the controller space, and classes that are tied to the Database generally belong in the Model space. You want to separate controller functions from model functions.