This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Will the setters be called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Will the setters be called" Watch "Will the setters be called" New topic
Author

Will the setters be called

dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
I have a form bean which has one setter method. This bean is associated with a jsp. Now i define this bean in my struts-config.xml file under the <form-beans></form-beans> tags. I DO NOT use the name attribute of the actions-mapping to associate the bean with my action class. Now my question are:
1) Will the reset,setter methods of the form bean be called?
2) Will the form bean be null in my action class?
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
Put in the "name" attribute in the corresponding action mapping in your strus-config and put validate="false" and scope="request".

In this case, when you come to your action class for the first time, and you try to retrieve it from the request object, it WILL return NULL.
dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
I dont want to put the name attribute. My question is( given the conditions mentioned in my above post )
1) Will the setters be called?
2) Will the form bean be null in the action?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by dnyan ginde:
1) Will the setters be called?
2) Will the form bean be null in the action?


1) No
2) Yes


Merrill
Consultant, Sima Solutions
dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
Thanks a lot Merill
dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
Thanks a lot Merill
 
Consider Paul's rocket mass heater.
 
subject: Will the setters be called
 
Similar Threads
ActionForm returning null in ActionClass
Error creating form bean of class
Problem with logic:iterate with Dynaform for multiple input parameters
Problem in using multiaction controller in spring
Basic JSF design question