aspose file tools*
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Will the setters be called