I have implemented a dynamic generated form.  In my
case I wanted to have a user profile page, where the
questions were stored in the database and could be
updated at any time.

The way I did this was when I dynamically generated
the form field elements I had a consistent name always
starting with "customproperty" followed by an index
number starting with zero.  For example
customerproperty1, customproperty2, etc...

Then inside the action class since I have access to
the request object I was able to do this:

int index=1;
while(request.getParameter("customproperty"+index)!=null)
{
   do something
   index++;
}


Hope this helps!

scott.
--- Web Programmer <[EMAIL PROTECTED]>
wrote:
> By "dynamically" I mean the form elements (input
> boxes) are generated based on values obtained from
> the
> database.  So if there are 5 items in a database
> corresponding to a category, then 5 text boxes would
> be displayed (using an iterate tag) with different
> names for each element (<input type="text"
> name="item1">, etc).  In that case, the FormBean has
> no getter method for item1, item2.., specifically.
> 
> 
> 
> 
> --- Chris Butler <[EMAIL PROTECTED]> wrote:
> > i think Struts support java beans specs as a base.
> > if the 'forms from the database' truly conform to
> > that spec, i guess yes.  however, given that they
> > are 'dynamic' i kinda doubt it...
> > 
> > i think we need more info on what 'dynamic' means.
> > 
> > c
> > 
> > At 05:11 AM 4/27/2001 -0700, Web Programmer wrote:
> > >Does strut support forms generated dynamically
> from
> > >the database? How would you get user-entered
> values
> > in
> > >the FormBean when you don't know how many
> elements
> > to
> > >expect or their names. I haven't seen any strut
> > >example that does that or anything in the mail
> > list.
> > >
> >
> >__________________________________________________
> > >Do You Yahoo!?
> > >Yahoo! Auctions - buy the things you want at
> great
> > prices
> > >http://auctions.yahoo.com/
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scott

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to