Check out indexed fields and map/list backed fields:
http://jakarta.apache.org/struts/faqs/indexedprops.html

David



From: Bradley Hill <[EMAIL PROTECTED]>
Reply-To: Bradley Hill <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Help using arbitrary number of params in a form.
Date: Thu, 13 Mar 2003 11:19:04 -0700 (MST)

I'm proving out Struts as a framework to migrate an existing webapp to. In this app, it
is common to have forms with an arbitrary number of grouped params that is
unknown until request time.


e.g., when a user requests a transfer, we create a form like (pseudo-HTML)


Foo Fund <input type=text name=pct0> <input type=text name=value0> Bar Fund <input type=text name=pct1> <input type=text name=value1> Fee Fund <input type=text name=pct2> <input type=text name=value2>

etc...

How many of these there are depends on how many funds a person has a current
balance in. In this case, this could be from zero to about 30. I realize I
could just overdefine these attributes in my FormBean or struts-config.xml for
DynaForms, but I'm reluctant to do so because in other parts of the app similar
logic is used for sets that can be from zero to hundreds or thousands.


Is there any way to handle this sort of thing in Struts? Ideally, I'd like to
be able to apply the same validation rules to each set of "paramName{$n}" fields
and to collect them together.


I've searched the docs, mailing lists and books, but can't find any examples of
this kind of thing.


Thanks!

Brad Hill
[EMAIL PROTECTED]



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


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



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



Reply via email to