ron1, Jim

thank you for your help.

i think part of my problem was that i was trying to use a
DynaActionForm instead of just creating and using my own ActionForm. 
now it appears to be working... for the most part. :)

andy


On Wed, 14 Jul 2004 12:02:27 -0700, Jim Barrows <[EMAIL PROTECTED]> wrote:
> 
> 
> > -----Original Message-----
> > From: Andrew Close [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 14, 2004 11:53 AM
> > To: Struts Users Mailing List
> > Subject: Re: More fun with forms...
> >
> >
> > <snip>
> >
> > > > i do know what fields will be returned, just not how many.  so i
> > > > wasn't sure if i could use ActionForms or if i had to
> > come up with a
> > > > custom solution.
> > > > i'll see if i can find info on MapBackedForm.
> > > > Thanks Jim
> > >
> > > Oh, you mean rows, not columns.  In that case you want a
> > list of objects, where >each object is a row.  You grab each
> > field from the resultSet, stuff it into a bean, >and then
> > stuff the bean into a collection.  Then you put the
> > collection in the >scope of your choice.
> >
> > well, yes.  that's the first part of it.  getting the data from the DB
> > to the page to be displayed.  so i have my collection.  now i'm going
> > to iterate thorugh the collection and build a form:
> >
> >
> > //JSP...
> > <html:form action=someaction>
> > <table>
> 
> <logic:iterate name="AFormNameThatMakesSense" property="bunchOStuff" 
> id="oneOfABunchOStuff"
>         <html:text name="oneOfABunchOStuff" indexed="true"/>
> </logic:iterate>
> 
> public class MyForm blah blah {
>         private String[] element;
>         private Collection bunchOStuff; //you can also put this into your favorite 
> scope
>         ...
>         appropriate getter and setters
> }
> 
> >
> > for (int i =0; i<collection.size; i++) {
> > <tr>
> > //some tds...
> > <td><html:text property=dynamicField[i] />  //my editable field
> > </tr>
> > }
> > </table>
> > <html:submit ... />
> > </html:form>
> >
> > so now i have a form being displayed with let's say 25 rows in it.
> > that's 25 editable textfields (assume they have unique id's or
> > something).
> > now my user views this, makes a couple of changes to some of the
> > editable textfields and hits submit.  the action receives the call and
> > begins to process the form.  BUT, how is the ActionForm or
> > DynaActionForm laid out so the Action can grab all the fields off of
> > it since we didn't know there would be 25 editable textboxes when we
> > started?
> >
> > <form-beans>
> >   <form-bean name=dynamicForm type=...DynaActionForm>
> >
> > how do i denote my 'X' editable fields here?
> >
> >     <form-property name=dynamicallyGeneratedFileds
> > type=java.lang.String[] />
> >
> > would that be what i want?
> >
> >   </form-bean>
> > </form-beans>
> >
> >
> > Thanks again,
> > andy
> > 
> > ---------------------------------------------------------------------
> > 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]

Reply via email to