• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt using E.L with HashMap

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I appologize if iam posting this message in the wrong section since iam new to the forum iam not sure where this goes.And i want to know how to use Expression Language with a HashMap that is if iam having a DTO in the Value of the Hashmap how can i use E.L to access the DTO in the JSP page it would be of great help for me Thank you in advance.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Once you bind your map to one of the scoped objects, you can access its entries with either the dot syntax or associative array syntax.


You should also read up on JSTL which can be used, among other things, to iterate over maps, arrays, lists, etc...
 
Aryaraju Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah Thanks man But i was looking for more specific answer i could use
something like
<c:forEach item="${rancher}" var="items">
<c:if test="${firstname==items.key}">
<c ut value="${items.value.firstname}"/>
<c ut value="${items.value.lastname}"/>
<c ut value="${items.value.salary}"/>
</c:if>
</c:forEach>

where firstname is scoped variable and the value is a DTO. I got the answer after i posted my question but thought it would be of future help
[ February 01, 2008: Message edited by: Arvind Kovuri ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But i was looking for more specific answer


You could try to ask more specific question next time, like you'd like to know how to iterate through a Map
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another JR tip:
At the bottom left of the edit screen is a checkbox for disabling those annoying smilies. It's a good idea to check that when entering JSTL code.

You did ask about EL, not JSTL.
They're different technologies. They go well together but their names are not interchangeable.
Are you confused about which is which?
[ February 02, 2008: Message edited by: Ben Souther ]
 
Aryaraju Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Some Ssosssss wrote:Yeah Thanks man But i was looking for more specific answer i could use
something like
<c:forEach item="${rancher}" var="items">
<c:if test="${firstname==items.key}">
<c ut value="${items.value.firstname}"/>
<c ut value="${items.value.lastname}"/>
<c ut value="${items.value.salary}"/>
</c:if>
</c:forEach>

where firstname is scoped variable and the value is a DTO. I got the answer after i posted my question but thought it would be of future help
[ February 01, 2008: Message edited by: ]

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic