Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

When is form Bean created ?

 
Shaan patil
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35977
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shaan,
I searched for "action form life cycle". The first hit was a clear ordered listing of the steps.
 
Shaan patil
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!