Pass first element of jsp list to javascript
- by Lucian Enache
Ok so I'm trying to access the first element of a JSP list,
here's what I've come up with so far without any kind of luck:
onclick="alert('<%=list[0]%>');"
What's the best approach to access the first element and eventually to pass it to a javascript variable/function ?
I've heard that the <% %> tags are deprecated and some are suggesting relaying on JSTL/EL how can one use those without having to iterate the entire list and put a breakpoint for the iterators ?