Currently I am using java servlets to set up Hashmaps, lists, and range of business objects and then pass them to a jsp page via request.setAttribute("myMap", myMap);
How can I directly access this data in javascript/jquery? What is the syntax ?
At the moment I am using jstl and EL expressions to loop through data and set the values of dom elements.
<c:forEach var="entry" items="${myMap}">
<input type="hidden" class="myClass" value='<c:out value="${entry.value}" />' />
</c:forEach>
I then use javascript/jquery to access these DOM elements.
$(".myClass").eq(1).val()
$(".myClass").eq(2).val()
Is their a way I can directly access, using javascript/jQuery, the page attributes that are set in servlet without first creating dom elements ?
I’d rather dump it in a javascript associative array: