Two Laptop Bag
The moose likes JSP and the fly likes HashMap in taglib Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "HashMap in taglib" Watch "HashMap in taglib" New topic
Author

HashMap in taglib

saumil baxi
Ranch Hand

Joined: Apr 18, 2008
Posts: 58
Hi,
How can i iterate my hashmap using taglib.

Thanks,
Saumil
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 813

Originally posted by saumil baxi:

How can i iterate my hashmap using taglib.

Saumil


Pass the value of the hashmap to the tag handler class and in the tag handler class you write the java code to iterate through the map....
Make sure your tag handler class has the Bean style setter method as that of the attribute name in your tag.

Hope this helps..
[ November 25, 2008: Message edited by: Sudipto Shekhar ]

Regards, Sud.
SCJP 5 ScjpFAQ JLS
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

What taglib? If you are talking about the JSTL, the <c:forEach> action is what you want.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 813




Pass the value of the hashmap to the tag handler class and in the tag handler class you write the java code to iterate through the map....
Make sure your tag handler class has the Bean style setter method as that of the attribute name in your tag.



Can we do it in this way?
Mi Ku
Greenhorn

Joined: Nov 21, 2008
Posts: 11
You could, but JSTL has a tag that will do it for you already. As Bear metntioned, the <c:forEach> tag.

What exactly are you trying to do?
saumil baxi
Ranch Hand

Joined: Apr 18, 2008
Posts: 58
Thanks..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HashMap in taglib
 
Similar Threads
traversing map unsing taglib
WA #1.....word association
struts 1.3 Interactive form
Not able to print collection in jsp through JSTL
switch on String