struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Waite <andrew.wa...@gmail.com>
Subject Re: Using Struts Validator on Map-backed ActionForms
Date Sat, 12 Feb 2005 22:50:35 GMT
Niall,

Thanks for the response. This is looking promising - excellent work, btw. 

I have the Action and Struts communicating with this "form".  Do you
have any example of how to apply the Validaror against it?  Looking
for some samples but given how new this is it's hard to come by.

Thanks,
Andrew


On Sat, 12 Feb 2005 19:32:41 -0000, Niall Pemberton
<niall.pemberton@blueyonder.co.uk> wrote:
> You could use a LazyDynaMap to do this (with Struts 1.2.4). LazyDynaMap is a
> "wrapper" for a Map. Because its not an ActionForm Struts will wrap it in a
> BeanValidatorForm, which you can use with Validator.
> 
> Just specify it in the struts-config.xml for your form.
> 
> <form-bean name="mapForm" type="org.apache.commons.beanutils.LazyDynaMap"/>
> 
> In your action you can get the actual Map in the following way...
> 
>     LazyDynaMap dynaMap = ((BeanValidatorForm)form).getInstance();
>     Map myMap = dynaMap.getMap();
> 
> http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/package-summary.html#dynamic.lazy
> http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/LazyDynaMap.html
> 
> Niall
> 
> ----- Original Message -----
> From: "Andrew Waite" <andrew.waite@gmail.com>
> Sent: Saturday, February 12, 2005 3:54 PM
> 
> > I have searched far and wide for an update to this topic but can not
> > seem to find an actual solution.
> >
> > Has anyone accomplished this? I know in one thread Ted Husted
> > mentioned it being possible but had questions about the use case, well
> > if you're listenening here's my use case.
> >
> > I am writing a client to a web-service that returns layout information
> > and field required/data types dynamically. I never know what the
> > schema will be but I do get the metadata in regards to  what the data
> > type is and whether the field is required for form submission.
> >
> > Hope that helps the creative juices out there.
> >
> > Thanks for any help that can be provided.
> >
> > Andrew
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message