How to copy java Array into javascript Array? -
i have .jsp page in used on click javascript function further validation , other processing stuff. i've created array in jsp scriptlets , how pass javascript function gets called when submit button hit? tried this:
var jsarray = <%=linearray%>;
but didn't work out.
in fact function wasn't getting called after put above scriptlet. how copy java array javascript array?
try this:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> var jsarray = [ <c:foreach var="item" items="${linearray}"> <c:out value="${item}"/>, </c:foreach> ];
this generate javascript array variable jsarray
, put java linearray
values it. if that's need do.
Comments
Post a Comment