struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "apachep2" <apach...@hotmail.com>
Subject RE: Line Items in ActionForms
Date Mon, 14 Apr 2003 12:44:00 GMT
Sorry, I cannot help since I don't use struts' validation api. But
logically, JavaBean should be more than enough for the underlying
fields.

-----Original Message-----
From: Hunter Hillegas [mailto:lists@lastonepicked.com] 
Sent: April 11, 2003 6:36 PM
To: Struts List
Subject: Re: Line Items in ActionForms

Thanks again.

Since I need to be able to do validation in the line items as well,
should
they be ActionForms as well, or just simple JavaBeans?

-H

> From: "apachep2" <apachep2@hotmail.com>
> Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> Date: Fri, 11 Apr 2003 15:09:06 -0400
> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> Subject: RE: Line Items in ActionForms
> 
> An empty form is not empty. For 10 line items, you have to create 10
> line items before you load the page. For example
> 
> MyActionForm myActionForm = new myActionForm() ;
> Collection myLineItems = new ArrayList(10) ;
> int I = 0 ;
> while (i<10)
> {
> myLineItems.add(new MyLineItem()) ;
> i++ ;
> }
> 
> request.setAttribute(mapping.getAttribute(), myActionForm) ;
> 
> -----Original Message-----
> From: Hunter Hillegas [mailto:lists@lastonepicked.com]
> Sent: April 11, 2003 3:02 PM
> To: Struts List
> Subject: Re: Line Items in ActionForms
> 
> Okay. It sounds like this is putting me on the right track. Thanks a
> lot...
> 
> What I'm really asking is about the source form... Any empty form with
> an
> arbitrary number of line items... With the master items, I just use
the
> same
> form names as the JavaBean properties... But what about for the line
> items... How do I name them so that when I send the form to Struts (an
> empty
> form, to create a new item), the proper ActionForms are created?
> 
> thanks,
> Hunter
> 
>> From: "apachep2" <apachep2@hotmail.com>
>> Reply-To: "Struts Users Mailing List"
<struts-user@jakarta.apache.org>
>> Date: Fri, 11 Apr 2003 14:59:17 -0400
>> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
>> Subject: RE: Line Items in ActionForms
>> 
>> Look at html:iterate/nested:iterate tag.
>> 
>> <nested:form action="/myAction.do">
>> <nested:text property="name">
>> <nested:iterate property="myLineItems" id="myLineItem">
>> <TH>
>> <TD><nested:write property="anyField"/></TD>
>> <TD><nested:text property="inputField"/></TD>
>> </TH>
>> </nested:iterate>
>> </nested:form>
>> 
>> Woe, I am really in a very casual Friday afternoon watching sunshine
>> outside my office window.
>> 
>> -----Original Message-----
>> From: Hunter Hillegas [mailto:lists@lastonepicked.com]
>> Sent: April 11, 2003 2:44 PM
>> To: Struts List
>> Subject: Re: Line Items in ActionForms
>> 
>> Okay. That makes sense...
>> 
>> Do I have to do anything special in the HTML form so that it knows
>> that's
>> what I'm doing?
>> 
>> How do I name the form items so that the proper line item beans are
>> created
>> and put into the appropriate collections?
>> 
>> Thanks,
>> Hunter
>> 
>>> From: "apachep2" <apachep2@hotmail.com>
>>> Reply-To: "Struts Users Mailing List"
> <struts-user@jakarta.apache.org>
>>> Date: Fri, 11 Apr 2003 14:43:50 -0400
>>> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
>>> Subject: RE: Line Items in ActionForms
>>> 
>>> Line items could be a Collection, List or Array in your ActionForm.
>> Each
>>> element is a JavaBean.
>>> 
>>> -----Original Message-----
>>> From: Hunter Hillegas [mailto:lists@lastonepicked.com]
>>> Sent: April 11, 2003 2:13 PM
>>> To: Struts List
>>> Subject: Line Items in ActionForms
>>> 
>>> I am converting an existing Web application to Struts 1.1.
>>> 
>>> In our current app, a user works with a form that has a info that is
>>> designated as part of the master item and also data that is part of
a
>>> dynamic number of "line items". Think of a sales order as a rough
>>> analogy...
>>> Some stuff is in the header type area, plus there can be any number
> of
>>> products sold on that order...
>>> 
>>> So... I am writing my first ActionForm and I'm not sure how to
> express
>>> the
>>> line items stuff... I will be needing to validate the line items and
>>> they
>>> need to autopopulate from the form...
>>> 
>>> In the current app, each line item property is suffixed with a
> number,
>>> in
>>> sequence, and the processing servlet just iterates through a for
loop
>> to
>>> get
>>> all the info...
>>> 
>>> So, with Struts... How do I:
>>> 
>>> 1. Express the line items in the ActionForm?
>>> 2. Name the properties on the HTML form so that the ActionForm is
>>> autopopulated correctly?
>>> 
>>> I read through 'Struts in Action' but couldn't find a similar
> example.
>>> 
>>> Any help is appreciated.
>>> 
>>> Thanks,
>>> Hunter
>>> 
>>> 
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>> 
>>> 
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


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


Mime
View raw message