struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Krygowski" <james.krygow...@shaws.com>
Subject RE: How to handle formbean for dynamically generated form?
Date Fri, 19 Jul 2002 14:44:08 GMT
i think it's safe to assume that the data will be accessible in the format
you suggest.

> -----Original Message-----
> From: Galbreath, Mark [mailto:Galbreath@tessco.com]
> Sent: Friday, July 19, 2002 10:09 AM
> To: 'Struts Users Mailing List'
> Subject: RE: How to handle formbean for dynamically generated form?
>
>
> Am I correct in assuming this data is stored in a database table like
>
> id     region     product     price
> --     ------     -------     -----
> 1        1        prod1       price1
> 2        1        prod2       price2
> 3        1        prod3       price3
> 4        2        prod4       price4
>
> etc.?
>
> -----Original Message-----
> From: James Krygowski [mailto:james.krygowski@shaws.com]
> Sent: Friday, July 19, 2002 10:00 AM
>
> How does struts figure out the association?  In my case, I have vertically
> "banded" tables to contend with:
>
>    region 1    |    region 2    |    region 3    |
> prod  | price  | prod  | price  | prod  | price  |
> ------+--------+-------+--------+-------+--------+
> prod1 | price1 | prod4 | price4 | prod7 | price7 |
> prod2 | price2 | prod5 | price5 | prod8 | price8 |
> prod3 | price3 | prod6 | price6 | prod9 | price9 |
>
> Do you still think that struts will figure out the associations in this
> case??
>
> thanks,
>
> Jim
>
>
> > -----Original Message-----
> > From: Galbreath, Mark [mailto:Galbreath@tessco.com]
> > Sent: Friday, July 19, 2002 9:36 AM
> > To: 'Struts Users Mailing List'
> > Subject: RE: How to handle formbean for dynamically generated form?
> >
> >
> > I've implemented this very thing - the elements will be
> > associated.  Try it.
> >
> > Mark
> >
> > -----Original Message-----
> > From: James Krygowski [mailto:james.krygowski@shaws.com]
> > Sent: Friday, July 19, 2002 9:33 AM
> >
> > Hi Keith-
> >
> > I recently posted a question similar to this one.  The difference
> > being that
> > i have a matrix of text input fields that must be related to each
> > other row
> > wise.  i.e.
> >
> > unique_id   description   cost  discount
> > ---------   ------------   ----  --------
> > 1		red widget     1.50  25%
> > 2           blue widget    1.60  20%
> > 3           green widget   1.00  50%
> >
> > now if all my unique_id fields are called unique_ids and all my
> > description
> > fields are called descriptions, how can I be sure that when these
> > properties
> > are read into the string array, they end up associated with the
> > right index?
> > I have to guarantee that 1, red widget, 1.50 and 25% are all in
> > element 0 of
> > their respective string arrays.  I can't depend on position
> > within the form
> > to cue me to row relationships.  I'm not sure that your suggestion will
> > handle this.  Am I missing something?
> >
> > thanks,
> >
> > Jim
> >
> >
> >
> > > -----Original Message-----
> > > From: Kamholz, Keith (corp-staff) USX [mailto:kkamholz@moog.com]
> > > Sent: Friday, July 19, 2002 9:25 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: How to handle formbean for dynamically generated form?
> > >
> > >
> > > Hey,
> > > You don't want to use 'firstname1', 'firstname2', etc, for
> the property
> > > names of your text input fields.  Just use 'firstnames' as the
> > > property for
> > > all of them.
> > > Then in your form bean, you would have something like this:
> > >
> > > public void setFirstnames(String[] array)
> > > {  firstnames =  array;  }
> > > public String[] getFirstnames()
> > > {  return firstnames;  }
> > >
> > > Struts will automatically fill in all the values from the
> form into the
> > > array.  Then if you want the values in your action class, you
> > can just get
> > > the array from the form bean.
> > > You would have something like this:
> > >
> > > MyFormBean info = (MyFormBean) form;
> > > String[] firstnames = info.getFirstnames();
> > > // do something with the array of firstnames here
> > >
> > > Does that makes sense to you?  It works very nicely.
> > >
> > > ~ Keith
> > > http://www.buffalo.edu/~kkamholz
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Ramu, Manjukumar [PRDUS] [mailto:MRamu@prdus.jnj.com]
> > > Sent: Friday, July 19, 2002 8:51 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: How to handle formbean for dynamically generated form?
> > >
> > >
> > > Keith,
> > > 	Thanks for the reply. In JSP I am using firstname1,
> > > firstname2....etc..depending on the sets the user selected. Now
> > my problem
> > > is to get the values in my Action Class. I am not yet clear how to use
> > > formbean in this case.
> > >
> > > You have mentioned to use array of strings. How the form bean
> > will process
> > > these values.
> > >
> > > I appreciate your help.
> > >
> > > Thanks,
> > > Manju
> > >
> > > -----Original Message-----
> > > From: Kamholz, Keith (corp-staff) USX [mailto:kkamholz@moog.com]
> > > Sent: Friday, July 19, 2002 8:39 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: How to handle formbean for dynamically generated form?
> > >
> > >
> > > It seems to me that you should use an Array of Strings to
> > represent those
> > > fields that will be duplicated.  When the form is submitted, each
> > > array will
> > > be automatically filled with the values of the specified
> property.  It's
> > > pretty easy to do.
> > >
> > > ~ Keith
> > > http://www.buffalo.edu/~kkamholz
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Ramu, Manjukumar [PRDUS] [mailto:MRamu@prdus.jnj.com]
> > > Sent: Friday, July 19, 2002 8:30 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: How to handle formbean for dynamically generated form?
> > >
> > >
> > > Hello,
> > > 	I have a scenario here. I am generating a form which is dynamic. For
> > > example this form has some fields like FirstName, Last Name,
> > > Email Address,
> > > Phone Number. These fields are 1 set. When the user enter the
> number of
> > > sets, the form will be generating. let say user selects 3
> sets, the form
> > > will displayed the above fields 3 times. I want to know how
> can I handle
> > > this situation using FormBean. I don't have maximum number
> for this set.
> > > User can enter any number to generate.
> > >
> > > I appreciate any helps.
> > >
> > > Thanks,
> > > Manju
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:struts-user-help@jakarta.apache.org>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



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


Mime
View raw message