Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect java class type using El with JSTL?

Tags:

jsp

jstl

el

code is like this:

 <c:forEach  items="${itemList}" var="item">
 //do stuff based on the class type of item                                 
 </c:forEach>

Is it possible to do that? Thanks!

like image 773
Bobo Avatar asked Feb 10 '11 15:02

Bobo


1 Answers

Yes, ${item.class} conforms to the javabeans convention, so you get the Class. Then you can get other properties.

If it doesn't work, use ${item['class']}

like image 112
Bozho Avatar answered Nov 15 '22 12:11

Bozho