Should every html form property have a corresponding formbean get/set and variable.?Can form property be omitted in a form bean?

Questions by shobana24

Showing Answers 1 - 11 of 11 Answers

Jayakanthan

  • Oct 26th, 2006
 

Yes every html field property have a corresponding formbean get/set methods. Otherwise you will get this (No getter Method) error.

chevuru

  • Nov 14th, 2006
 

Get & Set are not compalsary for each form. when you specify type as DyanActionForm in the form bean in struts-config.xml as below, with each field  declared as form-property

<form-bean name="DynaAddressForm"   
         type="org.apache.struts.action.DynaActionForm">
         <form-property name="name" type="java.lang.String"/>
         <form-property name="address" type="java.lang.String"/>
         <form-property name="email" type="java.lang.String" />
</form-bean>

  Was this answer useful?  Yes

No.
It is not neede to have every html form property have a corresponding form bean get/set and a variable.  For Ex. "submit" button is form property which may not be required to capture its value at server side.

But still if you want to have the form property value which is not in the formbean, you can use the convention way to get the property as:
request.getParameter("propertyName");

Mahes

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions