This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterating List of Maps through c:foreach  RSS feed

 
Kousik Majumder
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I have a list of maps.
Now I want to iterate the list in jsp page where i will give the key hardcoded to the map so that it returns the value corresponding to key.

Can somebody tell me how can I do that?





The bolded portion written in code does not work in foreach I suppose.
Please suggest.


Thanks,
Kousik


 
Vijitha Kumara
Bartender
Posts: 3973
24
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I guess this is a typo ?

 
Kousik Majumder
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,

That is a typing mistake.
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Kousik. Use for getting keys.

Use for getting values.
 
Kousik Majumder
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this will give the keys and values respectively which I do not want. I want a value with a particular key which i will give from outside like I showed before/below.
How can I do that?



Thanks,
Kousik
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this,
Here the KEY is name of the attribute and the value must be your HashMap key. For example, pageContext.setAttribute("KEY","java"); Here "java" must be your HashMap key.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!