• Post Reply Bookmark Topic Watch Topic
  • New Topic

SetupActions.  RSS feed

 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you find that for each form there has to be a SetupAction? In the book that I am reading, there seems to be a number of these, but I am not sure if my application would need them. What are they mostly for? Are they for loading the form with default data, or for some other reason.
Thanks
Mark
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which book are you reading?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually this kind of action is for pre-populating the values of a form when forms are in request scope.
Why not just put this logic into the reset method of the ActionForm? Because two different forms are used for each jsp page - one during the request that enters the jsp and one during the request that submits the jsp. This can cause issues when checkboxes get deselected and resubmitted.
You will not need the SetupActions if your forms are session scope (but putting them in session can be a hit to the server's memory).
You also probably do not need them if you do not need to prepopulate forms, a functionality often required when backwards navigation is a must.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just put this logic into the reset method of the ActionForm?

Because I don't have ActionForm classes, just DynaActionForms defined in the struts-config.xml file.
So Only for prepopulation of forms.
What about to load rows of data into a Table. Unless the Value Object is loaded into the Session Scope. correct?
Mark
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a SetupAction would also be useful to make data available to your forms. Grabbing VOs would be an example. Stick them in session until you can clear them out.
Also you can have PersistAction(s) as well that send groups of VOs back to the backend. Managing Setup and Persist Actions properly can keep those darn Value Objects from clogging up valuable memory.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations on your new job, by the way!
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!