• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

struts, probleme avec un arraylist dans un arraylist

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bonjour, j'ai du code qui mets un array d'items dans un arraylist<arraylist> simplement: (C'est un fichier .CSV, donc je veux le code 100% dynamique, je connais pas les noms des colons, je veux juste des cellule s�parar par le ;)

/***************************************************************************/
ArrayList<String> userList = new ArrayList<String>();
ArrayList<ArrayList<String>> userListArray = null ;
while ((line = bufRdr.readLine()) != null )
{
userListArray=new ArrayList<ArrayList<String>>();
st = new StringTokenizer(line,";");
while (st.hasMoreTokens()) /* looping on our columns, adding a new map each time */
{
userList.add(st.nextToken());
}
userListArray.add(userList);
}
request.setAttribute( "userListArray", userListArray);

//And so with struts i try to diplay it:
< logic:iterate id="userList" name="userListArray" type="java.util.ArrayList" >
<tr >
< logic:iterate id="users" name="userList" >
<td><bean:writename="users" /></ td >
</ logic:iterate >
</ tr >
</ logic:iterate >
/**********************************************************************************/
Apres ce code, j'ai l'information, mais tout sur 1 ligne, le double iteration ne marche pas, j'ai entendu qu'il faut utiliser "nested" mais comment faire dynamiquement? sans connaitre le nom du property?
Merci d'avance!
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"irelandsg irelandsg",
Welcome to JavaRanch!

We're pleased to have you here with us here on the ranch, but there are a few rules that need to be followed. One is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Initials are OK for the first and middle names but not the last. You can change it here


Also, please note. This is an English site.
If you don't fully trust language translation software and wish to post in your native language, you may do so but we require that there also be an English translation.

Thank you for your understanding.
-Ben

PS: We have a Struts specific forum. I'll move this thread to there for you.
[ July 22, 2008: Message edited by: Ben Souther ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!