How can i use java variable value in JavaScript -


i don't know if realizable, because don't have strong knowledge in javascript.

i want use java variable in javascript , xhtml code, have file path in java variable: applicationdadesversiobb.rutafitxerlog display follows in xhtml page in table follows:

<tr>   <th scope="row">#{literalscore['entorn.fitxerlog']}</th>   <td>      <a href="#{applicationdadesversiobb.rutafitxerlog}"  onclick="descarga([[${applicationdadesversiobb.rutafitxerlog}]])">#{applicationdadesversiobb.rutafitxerlog}</a>   </td> </tr>          

until fine, want once path clicked, file should downloaded, not able with: onclick="descarga([[${applicationdadesversiobb.rutafitxerlog}]])

the javascript descarga function:

<script type="text/javascript">     function descarga(file)     {         window.location=file;     } </script> 

i think problem have conversion of java variable values javascript values.

i tried changing onclick="descarga([[${applicationdadesversiobb.rutafitxerlog}]])" onclick="descarga("#{applicationdadesversiobb.rutafitxerlog}")"

but no way, help?

you need quotes around string

onclick="descarga('[[${applicationdadesversiobb.rutafitxerlog}]]')" 

Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

html - Not able to access next element of an array javascript -