This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Iterating List of Maps through c:foreach  RSS feed

 
Ranch Hand
Posts: 244
  • 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


 
Bartender
Posts: 4050
54
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: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,

That is a typing mistake.
 
Ranch Hand
Posts: 437
Java Oracle
  • 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: 244
  • 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
Java Oracle
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!