struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <ja...@metastuff.com>
Subject Re: Struts and the form lib
Date Tue, 05 Sep 2000 07:40:48 GMT
I think the restriction that a Form must be a JavaBean with getters &
setters for all of the form 'fields' could be lifted for dynamic forms. I'd
like it to be possible to use a Map instance to store the key/value pairs of
the form data and have form validators which use a Map.

We could have a small interface something like :-

public interface MapFormValidator {

    public String[] validate( Map formData );

}

Both the 'type safe' and 'dynamic' approaches have their pros and cons.

Regards
James

James Strachan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
web: http://www.metastuff.com
mail: james@metastuff.com

----- Original Message -----
From: "Craig R. McClanahan" <Craig.McClanahan@eng.sun.com>
To: <struts-dev@jakarta.apache.org>
Sent: 04 September 2000 20:15
Subject: Re: Struts and the form lib


> Simon Oldeboershuis wrote:
>
> > Hi,
> >
> > I think there was a misunderstanding, I was not precise enough by
> > describing the aim of our webapplication. This is the problem...
> >
> > the forms that we want to implement are so dynamic that is not possible
> > to ensure that the form bean has all the properties that we ever submit.
> > Even worst, not only the number of fields will be different in these
> > forms; the types of the fields (radio buttons, text fields) will be also
> > different every time, and there are THOUSANDS of generated dynamic
> > forms.
> >
> >    It doesn't seem very nice to generate dynamically a bean for every
> > form. There has to be something like a setter with name, value
> > parameter... which is not really bean conform (is it?). However, I am
> > not sure if this a direction struts want to aim at ...  So that we were
> > thinking about to develop a new tag library designed to manage this kind
> > of forms. Suggestions on how to implement it are welcomed.
> >
> > Simon
> >
> > PS: I think it can ease a lot of pain, having a generic interface to all
> > parameters via name value.
> >
>
> There is such a generic interface already available for receiving and
processing
> the dynamic parameters of an incoming request -- your action method could
do
> something like this (assuming it is a GET -- similar but different code is
needed
> for a POST):
>
>     String queryString = request.getQueryString();
>     Hashtable parameters =
>       HttpUtils.parseQueryString(queryString);
>
> and you will get back a Hashtable that is keyed by parameter name.  The
values
> will be String arrays of all the values that were submitted for that
particular
> parameter, and you can go grab what you need.
>
> This isn't going to help you construct the forms themselves, though ...
the
> Struts form tags assume that the previous bean values will be actual
properties
> of a real bean, rather than looked up generically.  What kind of
modifications to
> the form beans do you think might make sense to support this?
>
> Craig
>
> ====================
> See you at ApacheCon Europe <http://www.apachecon.com>!
> Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
> Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
>                                     Applications to Tomcat
>
>
>



Mime
View raw message