Fill javascript array using jstl array -
i have jstl array with,
<sql:query var="list_str" datasource="${myds}"> select * str; </sql:query>
now want fill single column content of table str in javascript array. trying this.
<c:foreach items="${list_str.rows}" var="user" varstatus="status"> var val = ${user.name}; fruits.push(val); </c:foreach>
but, fruits array value empty, can please guide how accomplish this.
you don't need var val
, need quotes around become hard-coded string literal in resulting javascript code.
<c:foreach items="${list_str.rows}" var="user" varstatus="status"> fruits.push('${user.name}'); </c:foreach>
Comments
Post a Comment