Looks OK.
However, I would not use a basic array (private members) but ArrayList,
HashMap or LinkedList, etc.
I did not manage to have arrays working (the lazy initialization
failed).
You will have problems in JSPs.
Le dim 26/10/2003 Ã 18:04, Rajat Pandit a Ãcrit :
> Hello fred,
> Thanks for the reply, so just for clarifiation, if I am using a
> property which will be "indexed" then the getters and setters will be a
> little different from the usual set and get
> Ie
>
> public String getBidAmount(int index) {
> return bidAmount[index];
> }
>
> And
> public void setBidAmount(int index, String val) {
> bidAmount[index] = val;
> }
>
> And have to implement the bidAmoutn as an array?
> Protected String[] bidAmount;
>
> Do confirm if igot that right?
> Thanks once again for ur time.
>
>
> -----Original Message-----
> From: Frederic Dernbach [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 26, 2003 8:23 AM
> To: Struts Users Mailing List
> Subject: Re: Indexed properties help!
>
>
> Rajat,
>
> Here is an example of an indexed property called 'signal' (in my
> application it holds complex objects, not simple strings or integers):
>
> public OrderedSignalBean getSignal(int index) {
> while( index >= this.getSignals().size() ){
> this.getSignals().add(new OrderedSignalBean());
> }
> return (OrderedSignalBean) this.getSignals().get(index);
> }
>
> public void setSignal(int index, OrderedSignalBean signal) {
> while ( index >= signals.size() ){
> signals.add(new OrderedSignalBean());
> }
> signals.set(index, signal);
> }
>
> The 'signals' member is private and is of type 'ArrayList'. It is
> created in the form's contructor and the reset method of the form :
> signals = new ArrayList().
>
> The setter and getter methods of the indexed property perform so-clled
> "lazy-initialization" so you do not have to worry about the siez of the
> array list.
>
> Hope this helps.
>
> Fred
>
>
> Le dim 26/10/2003 Ã 16:54, Rajat Pandit a Ãcrit :
> > Hello,
> > I am pasting some excepts from the struts documentation. It would be
> > really great if someone could help me clear this.
> >
> > Question 1:
> > <!-- snip -->
> > The "indexed tags" feature is provided by several tags that have an
> > optional boolean "indexed" attribute. This is only legal when inside a
>
> > "<logic:iterate>" tag. When the "indexed" attribute is true, then the
> > tag will incorporate the loop index into the resulting HTML component.
> >
> > The several tags that support the "indexed" attribute can be broken
> > into three groups, split by what they do to incorporate the loop index
>
> > into the resulting HTML component.
> > Group 1 Group 2 Group 3
> > checkbox button link
> > file image
> > hidden submit
> > password
> > radio
> > select
> > text
> > textarea
> >
> > In Group 1, all of these tags will generate an HTML "name" attribute
> > of "name[nn].property". The value of each tag will also be initialized
>
> > by the getter method corresponding to that property specification.
> > <!--snip -->
> >
> >
> > So if I have name[nn].property, that essentially means I am creating
> > an array of the form. But what I really need is an array of property,
> > instead of the bean.
> >
> > Question 2:
> >
> > How should the property be declared in the the actionForm if it has to
>
> > receive an array of information.
> >
> >
> > thanks
> >
> >
> >
> >
> > Rajat Pandit | [EMAIL PROTECTED]
> > +91 612 3117606
> > [ Developer and Part Time Human Being]
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
> ---------------------------------------------------------------------
> 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]