File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Putting my head into Strurts....

 
Julie Desuza
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Leandro Melo
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic