Can you tell me how to set HashMap in request attribute using JSTL tag.. I am able to set HashMap in scriptlet and Iterate successfully, But when i try to set HashMap in request attribute using JSTL tag. I am getting the following error
Why bother? Since you're hard-coding the values into the JSP to being with, why not just use those values directly in the HTML rather than going through the overhead of the Map? You're introducing a lot of complexity that isn't necessary.
If this is just an example and the values are not hard-coded, why isn't this being done in the controller?
Or, if you insist on doing it this way (not recommended), just uncomment the setAttribute() call and forget using the JSTL for this -- working with scripting variables is not what the JSTL was meant for. It's like using a nail file to comb your hair.
Not if the Map is only available as a scripting variable. Scripting variables are invisible to the JSTL as, again, they are not intended to be used in concert.
JSP Rule #1: if it's hard to do on a JSP page with the JSTL/EL, there's a good chance that it's not something that you should be doing in a JSP in the first place.
If you are going to use scriptlets to create the Map on the page (still a futile exercise, in my opinion), then use scriptlets to create the scoped variable. Don't try to shoe-horn the wrong tool into the mix.