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

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -