I am a newbie programmer and I am trying to learn struts by building small applications. I have created a form to accept username and passowrd. I chek the value entered by user against database. I am using hibernate for this. I have all my calls done inside execute method. I feel this may not be the way it is done in real projects. Am I right? if yes, pls guide me about the classes I need to build to totally separate my data access logic from my struts action code.
posted 9 years ago
All the Struts projects that I have worked on have used an EJB tier to implement the business logic. These days Spring seems to be more in favor than EJB (though EJB has it strengths and EJB 3.0 is supposed to be pretty slick). Depending on the requirements of your project you may want to look into EJB or Spring. In any case it probably makes sense to move out logic like validating login information out of your Action class and into a reusable class that could be access from multiple actions.