Yes, Adam .. this is a valid point , that i need to consider.

But, it is almost impossible to define a bean for each type of data, in my application. I need to use the dynabean and dynaclass , some how.

I managed to find a solution for populating the bean , now i have to find a solution for validation too.

Suggest me a suitable validation approach..

With Regards,
R Balaji

Adam Hardy wrote:

I can see that you could just iterate over the unknown form properties in the JSP, but how would you label them? And when the form is submitted, how would you validate them?

I think you would be better advised to add your list of properties as beans to your form. In each bean you could also have a label and a validation.

my 2 cents.
Adam



On 08/23/2003 12:03 PM Mark Lowe wrote:

You cant dynamically add properties to DynaActionForms. I'm not sure why you've a problem with just adding the fields to you form bean in struts config. I've demonstrated how to literally do what you want, but you'd have to specify the properties you want in you jsp anyway. But here goes....

You could create a new form bean copy the properties across from you old one and then add some new stuff..

DynaActionForm oldForm = (DynaActionForm) form;

//get the map out and mess with this and life should be simpler that using the dynaBean
Map oldFormMap = oldForm.getMap();


oldFormMap.put("statusChangeTime","A new Time");

DynaActionForm newForm = new DynaActionForm();

BeanUtils.populate(newForm, oldFormMap);

If this doesn't work you can try constructing all you dyna properties, having a DynaProperty[] array and then use the dynaBean constructer that takes a properties array.

Cheers Mark


On Saturday, August 23, 2003, at 04:42 AM, R Balaji wrote:


Dear All,
I have an application which returns a varity of properties, which can not be decided at design time. I would like to populate the Business data into a dynaValidatorForm and display them.


In this case, it is not possible to specify all the properties as <form-property>. If i set properties, without specifying them in the struts-config.xml, i am getting exception as mentioned below.

java.lang.IllegalArgumentException: Invalid property name 'statusChangeTime'
at org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm. java:598)
at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:412)
at com.adventnet.nms.webclient.topo.details.ObjectDetailsHandler.populateV iewBean(ObjectDetailsHandler.java:63)
at com.adventnet.nms.webclient.topo.details.ObjectDetailsHandler.fetchObje ctDetails(ObjectDetailsHandler.java:49)
at com.adventnet.nms.webclient.topo.details.ObjectDetailsAction.execute(Ob jectDetailsAction.java:54)


Please help me , in this regards,

Thanks in Advance.
With Regards,
R Balaji


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to