• 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

Putting my head into Strurts....

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to confirm from experts. I am new in Struts environment and trying to put my head into it. I assume the following.

If I have 5 input JSP forms then �

I can have 5 separate Action Form Beans (one for each form), having only getXXX() and setXXX() without implementing any business logic.

OR

I can have only single Action Form Bean for all the 5 forms.

If my one form contains 3 different actions such as Send / Cancel / Reset then I will have three action classes (One action class per each action). Every action class will have an execute() , which will return me an object of ActionForward class.

Am I going in the direction ?

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

Originally posted by Julie Desuza:

I can have 5 separate Action Form Beans (one for each form), having only getXXX() and setXXX() without implementing any business logic.


Yes, you can have 5 diferent form beans, one per page, but i didn`t understand about what you said with "business logic". The only place you should implement some weak business logic in Action Forms is in the validate method.

Originally posted by Julie Desuza:

I can have only single Action Form Bean for all the 5 forms.


Wel, if your 5 forms contains the same field, you can map the 5 jsps to use the same form (in struts-config.xml).

Originally posted by Julie Desuza:
If my one form contains 3 different actions such as Send / Cancel / Reset then I will have three action classes (One action class per each action). Every action class will have an execute() , which will return me an object of ActionForward class.



This is not a good strategies. It`s usual to build actions that encapsulates some basic functionality, for example, the CURD (create, update, retrieve and delete) operations of some specific funcionality should be placed in the same Action using methods name create, update, retrieve and delet. The same applies to the example you mentioned, Send, Cancel, and Reset should be placed in the same action because they actually deal with the same data.
The best way to do that is using DispatchAction and LookupDispatchAction with any other needs your application requires. An example of LookupDispatchAction follows
here
[ September 06, 2004: Message edited by: Leandro Melo ]
reply
    Bookmark Topic Watch Topic
  • New Topic