Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database access in Struts -- best/common practice?

 
John Fontana
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen many Struts example applications, and the database layer is always different -- some use Torque, others use JDBC calls within the FormBean. What is the most common solution? I am not using EJB's, and I understand that Struts is designed in such a way that you can use any data model...but in all methodologies there always seems to be the solution that works 90% of the time....any suggestions?
 
Michal Bienek
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best practice I've seen is to ensure complete seperation between the classes that access the database and Struts. In general, the best practice is to have DataAccessObjects (DAOs) access the database directly (and therefore hide the database interface completely from your application). These in turn should be called from a business object layer. Then the Struts Actions will talk to these business objects. That is by far the best layered approach.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic