| Author |
Passing a hashmap to a tag file
|
Nauman Hasan
Ranch Hand
Joined: Jul 27, 2005
Posts: 34
|
|
Hi folks,
I am using Tag Files with JSP and ran into a puzzling issue. Just as background I am using JDK 1.6 and Apache Tomcat 6.0.33. In short the same code in tag seems to be causing a exception. So what I am wondering is if there is translation occuring in between the JSP and Tag file (even with tag attribute is marked as dynamic). Thanks for your help!
In the main JSP page I have the following (snippets)
The output is
In the tag file I have following code snippets
If don't put in the last forEach then I get
Otherwise there is an exception
Any help would be appreciated.
~Nauman
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1002
|
|
You are missing a vital element in the declaration of the attribute in your tag file:
Unless you specify the type, it assumes the attribute you are declaring is a String.
Doing a <c:forEach> over a String is valid (assumes it is a comma separated list of strings, and so returns each element as a String)
Hence why the first loop 'works' but the second one failed.
|
 |
Nauman Hasan
Ranch Hand
Joined: Jul 27, 2005
Posts: 34
|
|
You sir and fabulous!
Thanks it works now
~Nauman
|
 |
 |
|
|
subject: Passing a hashmap to a tag file
|
|
|