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

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -