I read your solution for populating the dynaform. How do you display it in JSP? I mean, how does the JSP know what the field names are?

I don't really know the internal workings of the dynavalidator form and how struts would populate the form bean with request parameters. You would probably have to do the same formbean initialization in the bean's reset method, otherwise the request parameters will probably not get saved to it.

Once you get that far, then validation becomes an issue. At design time you don't what the fields of a form will be - but do you know how any particular type of field should be validated? If so, how do you know? Is that in the design?

Adam

On 08/23/2003 05:34 PM R Balaji wrote:
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]





-- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9


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



Reply via email to