• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt using E.L with HashMap

 
Aryaraju Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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 Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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: ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic