Passing jstl's foreach varStatus into javascript -
is possible?
<c:foreach var="list" items="${requestscope.data}" varstatus="count"> <script> myfunction(false,[]) // want pass `varstatus` on 2nd argument </script> </c:foreach>
i've tried putting :
myfunction(false,${count.index}); myfunction(false,<c:out value="${count.index}"></c:out>);
none of worked. help appreciated. thanks!
please seek these tests. work me. but, using name "count varstatus confusing. "count" name of current 1-based iteration count in looptagstatus interface.
<c:foreach var="list" items="a,b,c" varstatus="count"> myfunction(false,${count.index}) <br/> </c:foreach> <c:foreach var="list" items="a,b,c" varstatus="status"> myfunction(false,${status.index}) <br/> </c:foreach> <c:foreach var="list" items="a,b,c" varstatus="status"> function(false,${status.count}) <br/> </c:foreach> <c:foreach var="list" items="a,b,c" varstatus="count"> function(false,${count.count}) <br/> </c:foreach>
javascript foreach jstl
No comments:
Post a Comment