Hi all.
i need access from a jsp to some params of a list included in a model.
How can i access for exmple to the size of the list?
I know how to access the elements in the list but what tag do i have to use to access the params?
thx
Hi all.
i need access from a jsp to some params of a list included in a model.
How can i access for exmple to the size of the list?
I know how to access the elements in the list but what tag do i have to use to access the params?
thx
Out of my head: size() in the java.util.List() interface is not a property but a method. Calling methods on objects using EL is only supported in JSTL 1.1, by using the function taglib. See for instance:
http://java.sun.com/webservices/docs...doc/JSTL8.html
Hi,
I need to get size of a list in model, on a JSP page, as you mentioned!
Did you figured it out?
I think one way(may be not the best) is to just put the list size as an request attribute!!
Please let me know if you figure out better way!
Thanks,
Jay
If you can't use JSTL 1.1 (for instance because your container does not support JSP 2.0), you should either use scripting, or store the size as a request/page scoped attribute, as you suggested.
Or upgarde your container ...
Rgrds, Thomas
This is what i want to do: i have a model with images and i want to show them in rows of five images.
This could be the code in plain Java:
how can i do that with jstl????Code:Iterator it = model.getIterator(); int num = 0; while (it.hasNext()) { Image image = (Image)it.next(); if (num % 5 == 0) { // NEW ROW <tr><td>....image....</td></tr> num = 0; } else { <td>....image....</td> num++; } }
I response myself using java without jstl:
Code:<table> <% int num = 1 %> <tr> <c:forEach items="${model.images}" var="image"> <% if (num % 5 == 0) { %> <td><img ....></td> </tr> <tr> <% } else { %> <td><img ....></td> <% } num++; &> </c:forEach> </tr> </table>