temp temp wrote:
I solved the problem by creating an instance of
AddressVO in the formbean.
Here is my code after modifications.
public class ServiceSelectionForm extends ActionForm
{
private AddressVO addressVO = new AddressVO();
public AddressVO getAddressVO() {
return addressVO;
}
public void setAddressVO(AddressVO addressVO) {
this.addressVO = addressVO;
}
}
I am wondering is this the right approach or is there
a better way to deal with nestedbean in a formbean
or how to create an instance of nestedbean in a
formbean.
Note: forwarded message attached.
The normal way to setup your form beans is to have an action that is
called before the page which displays the form -- in other words, your
HTTP request is mapped to a Struts action; the action creates and
populates the form bean, then forwards to the JSP to display it.
If you only ever need to have an empty AddressVO instance (i.e. you
don't need to pre-load / pre-populate data in that AddressVO object)
then what you've done is fine, though note that you should probably also
have a reset() method that re-initialises the addressVO member field so
you don't get unexpected results if a form bean instance is reused.
See the Struts User Guide [1] for more information, particularly
sections on building form beans [2] and using them [3].
L.
[1] http://struts.apache.org/userGuide/index.html
[2] http://struts.apache.org/userGuide/building_model.html#actionform
[3] http://struts.apache.org/userGuide/building_view.html#form_beans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]