Pass first element of jsp list to javascript
Posted
by
Lucian Enache
on Stack Overflow
See other posts from Stack Overflow
or by Lucian Enache
Published on 2012-10-12T09:33:23Z
Indexed on
2012/10/12
9:36 UTC
Read the original article
Hit count: 261
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 ?
© Stack Overflow or respective owner