• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 Action best practice

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I was just wondering if someone could give me their views on the 'best practice' for struts2 when it comes to Actions.
I have been creating an app that currently uses a UserAction class; this contains all my methods for login, loginConfirm, register, registerConfirm, userProfile etc etc etc.

I was just wondering if it is considered 'right' to group all User actions in one class, or is I should be doing something like:-
UserLoginAction, UserregisterAction, UserProfileAction. Or does it really not matter.

Just really wondering if I'm heading down the right road, or straying away from Struts 'best practice'.

Cheers in advance
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keep in mind that the Struts Framework Action class is a component of a Struts-based Controller (in MVC terms.) When programmers use Struts while building their applications, they add behavior to a Controller by creating customized Action classes and then configuring them with the other parts of the Controller that come with the Framework.

To summarize, custom Action classes, the pre-written Struts classes and an instance of struts-config.xml together are your Controller. You should not code customized business logic in Action classes, i.e. the Controller. This logic belongs in Model classes, not Controller classes.

A Presentation-tier Business Delegate is typically the mediator between a Controller and Model.

http://java.sun.com/blueprints/patterns/BusinessDelegate.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic