struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ezequiel Puig" <e.p...@vivacances.fr>
Subject [s2] Tag iteration with Array
Date Tue, 03 Apr 2007 12:26:36 GMT
 

Hi people,

 

I am trying to iterate over an array.

 

In my action, i have defined:

 

Private String[] myArray;

 

public String[] get MyArray () {

return myArray;

}

public void setMyArray (String[] myArray) {

            this.myArray = myArray;

}

 

in the jsp, i am trying to acces to every entry:

 

I have tried that:

 

<s:iterator value="myArray" status="status">

<label><input type="checkbox" name="aa" id="aa" checked="checked" /><s:property
value="myArray[0]"/></label>

</s:iterator>

 

And it's working (in my action i have give some values to the array). I am getting every time
the same value. Normal.

 

But i am interested in iterate over the array, so i have tried this:

 

<s:iterator value="myArray" status="status">

<label><input type="checkbox" name="aa" id="aa" checked="checked" /><s:property
value="myArray[status.index]"/></label>

</s:iterator>

 

Surprinsigly, it's not working.

 

Do you konw how I can access to the values from the array??

 

Thanks!

 

Ezequiel Puig
Developer
13, rue Camille Desmoulins 
92441 Issy-les-Moulineaux Cedex
Tél. +33 (0) 1 58 04 23 63
  
Vivacances - une marque du groupe européen Opodo.

Vols, séjours, week-ends, hôtels, locations, voitures, assurances.
www.vivacances.fr <http://www.vivacances.fr/>  

The information in this e-mail is confidential and may be legally privileged. It is intended
solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are
not the intended recipient, any disclosure, copying, distribution or any action taken or not
taken in reliance on it is prohibited and may be unlawful. If you receive this e-mail in error,
please delete it and notify us by return. 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message