aspose file tools*
The moose likes JSP and the fly likes how to show map of maps in jsp,struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to show map of maps in jsp,struts" Watch "how to show map of maps in jsp,struts" New topic
Author

how to show map of maps in jsp,struts

Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

I got a problem where I have to iterate and show HashMap(<HashMap>,string) on a jsp page. I am using another HashMap as a key(as per my business scenario)

can anyone help me understand how I can achieve it through JSP or struts.


thanks
Tanu Gulati
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


This is an earlier post I found on The Ranch.
Iterate Map through Struts

Tweak according to your situation. And feel free to post any queries...

Cheers,
Raj.
Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

This is an earlier post I found on The Ranch.
Iterate Map through Struts


I actually got this before posting on codeRanch but in my case the problem is little different I have a HashMap(say hashmap1) which contains another HashMap (say hashmap 2) , i want to get the values of hashmap2 as a group and print against a value.


Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


You can use the custom tags to iterate through each map and embed all of this within the correct HTML tags to get the desired display, correct?

I do not see the problem you face...

Cheers,
Raj.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61241
    
  66

Custom tags are not necessary. The JSTL and EL are perfectly able to deal with Maps of any type.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


I mentioned "custom tags" as Struts relies on a few by default.

Since you mentioned JSTL and EL:

I have seen that they do not cause errors on the web page but apart from that is there any noticeable performance degradation?

Cheers,
Raj.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61241
    
  66

Compared to what?
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


Bear,

I was trying to compare the performance, Custom tags vs JSTL/EL.

Cheers,
Raj.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61241
    
  66

Why should there be a performance difference? The JSTL and other custom tags are based on the same tag mechanism.

The EL is built into the JSP engine so it's likely highly optimized.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


Thank you, Bear.

I felt that using a Custom Tag would involve invoking the tag handler and hence added a layer altogether which might cause some (slight) overhead.

Now as EL has been built into the JSP engine and this could probably eliminate this overhead.

What I was trying to figure out is the best practices when it comes to usage of Custom Tags.

Cheers,
Raj.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61241
    
  66

Best practice is to use the JSTL for what it does and only use other custom tags for things that the JSTL does not provide.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


Thank you so much Bear.

This was a doubt I have been having for quite a while.

Thanks,
Raj.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to show map of maps in jsp,struts