• 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

How many Actions should I use in my application?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need to develop an application it demands lots of tasks in it. so how should i develop my struts application?

1 should I use one action for each task. ( loose coupling)

2. I use Only one Action for all the tasks ( tight coupling) . using something like url.do?method='task' and
checking the method in if condition of the execute method. and implementing the logic there in the if block. and forwarding request to that perticular forward

which is the better way and why?

Thanks
Bhargavshankar
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First thing first, never make all the business logic in single or few Action classes, make separate Action class for separate logical business activity.

bhargav shankar wrote:using something like url.do?method='task' and
checking the method in if condition of the execute method. and implementing the logic there in the if block. and forwarding request to that perticular forward


You should look for the Struts Dispatch Action for this.
http://www.jguru.com/faq/view.jsp?EID=897290
 
bhargav shankar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sagar Rohankar wrote:First thing first, never make all the business logic in single or few Action classes, make separate Action class for separate logical business activity.



is there any reason behind this? Could you explain why?
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

bhargav shankar wrote:

Sagar Rohankar wrote:First thing first, never make all the business logic in single or few Action classes, make separate Action class for separate logical business activity.



is there any reason behind this? Could you explain why?



Don't you think jumbling all the programming logic in one class and making it 2000 LOC (If your app is large having more than 10 pages) and separation each action using multiple if..else statement which is considered as bad programming practice.
Its hard to maintain such code (google for agility development process) to change the single line of code you have to search thousands of line of code just to get there. Separation is good thing.

I'm not experienced and not guru in development, see what other rancher have to say about this.
 
bhargav shankar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your information sagar,
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If that helps you, then welcome
 
They worship nothing. They say it's because nothing lasts forever. Like this 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