• 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 Classes

 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One thing I'm not clear on for Struts2 action classes is how many there should be per action. For example, lets assume I have a group of 3 related actions: list a set of records, delete a record, add a record. Should that be setup as one action class or 3? I found tutorials which show how to setup a struts.xml to do it with one action class such as:



But is this a good practice? It seems like its random which command could be considered "execute()". Is it ok to not have an execute command?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scott Selikoff wrote:But is this a good practice?



That Depends. Personally, I like to keep CRUD methods together and have a naming convention so I can easily trace the execution flow like so:
CustomerAction -> CustomerLogic -> CustomerDAO -> CustomerTableInDatabase
There's nothing inherently wrong with creating seperate actions for CRUD functions.

Scott Selikoff wrote:
Is it ok to not have an execute command?



Sure. That's a welcome feature in Struts 2 as opposed to Struts 1
 
Whatever. Here's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic