This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

accessing n value of a list  RSS feed

 
wbrian radley
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,

given a bean - called abean- stored in the session which has as a field an ArrayList<String> - called labels;
at different points in the jsp file I need at access a particular element in the list;
for example: labels.get(3) in one place and at another labels.get(4);
in my situation a forEach loop would not be appropriate.



I tried but the output was blank
generated an error.

I looked for an answer but found none; is it possible?

any assistance would be greatly appreciated.

B
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
143
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${abean.labels[3]} is the correct syntax.

If it's blank, either it's beyond the end of the List, or the construct is simply not what you think it is.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!