Hy all,
while using valorize or populate Action method I noticed it doesn't
valorizes/populates nested bean's properties.
I try to report an example using registry module :
For I.e :
Person is composed by a Name so..how can i populate/valorize its properties
?
I use a <formbean> in struts.xml defined in this way :
<form-bean name="contactForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="id" type="java.lang.String"/>
<form-property name="firstname" type="java.lang.String"/>
<form-property name="lastname" type="java.lang.String" />
<form-property name="age" type="java.lang.String" />
</form-bean>
.....
.....
PersonAction
public String select(ActionForm form, HttpServletRequest request,
HttpServletResponse response, ActionMapping mapping) throws ActionException
{
String id = request.getParameter("id");
Person customer;
if (id != null && !id.equals("0")) {
customer = (Person)
net.smartlab.web.registry.Domain.getInstance().findEntry(id);
super.populate(form, customer, Locale.ITALY);
//I would like to avoid this part of code
//DynaActionForm dform = (DynaActionForm) form;
//if (customer.getName() != null) {
//dform.set("firstname", customer.getName().getFirstname());
//dform.set("lastname", customer.getName().getLastname());
//}
......
}
I would like to avoid commented code ,delegating super.populate to do it.
Is it possible?
There some method that I don't know ?
Waiting for replay...
Thanks
--
View this message in context: http://www.nabble.com/How-to-use-DynaActionForm-with-nested-beans-tp16648680s17546p16648680.html
Sent from the SmartWeb Users mailing list archive at Nabble.com.
|