Meaningless Drivel is fun!*
The moose likes Struts and the fly likes When is form  Bean created ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "When is form  Bean created ?" Watch "When is form  Bean created ?" New topic
Author

When is form Bean created ?

Shaan patil
Ranch Hand

Joined: Dec 22, 2007
Posts: 58
Hi,

I need to know when exactly a form bean is created ?

Is it created after we submitt or before we submitt a form ?

If it is reated after we submitt a form, then How is prepopulation of fields in the form takes place ?


Regards


"You cannot change the truth but truth can change you "
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

Shaan,
I searched for "action form life cycle". The first hit was a clear ordered listing of the steps.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Shaan patil
Ranch Hand

Joined: Dec 22, 2007
Posts: 58
HI,

Thanks for the link. I went throught it.

If we follow the steps listed there,then How do you explain pre-populating of form fields(Default values in text fields of a form from default bean values ) when a jsp is requested ?


Regards
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This same life cycle occurs even if you just request a JSP that uses Struts tags. The first time the JSP engine encounters a Struts tag, it will initiate the ActionForm lifecycle.

Step 2 (Create or recycle ActionForm) and step 3 (call reset) is where any default values are placed into an ActionForm. If the form is in session scope and existed before this request, any values placed in the ActionForm properties by previous requests will still be there.


Merrill
Consultant, Sima Solutions
 
 
subject: When is form Bean created ?