I don't know if this is realizable, because i don't have strong knowledge in JavaScript.
I want to use Java variable in Javascript and XHTML code, i have a file path in java variable: applicationDadesVersioBB.rutaFitxerLog which i display as follows in XHTML page in a table as follows:
<tr>
<th scope="row">#{literalsCore['Entorn.FitxerLog']}</th>
<td>
<a href="#{applicationDadesVersioBB.rutaFitxerLog}" onClick="descarga([[${applicationDadesVersioBB.rutaFitxerLog}]])">#{applicationDadesVersioBB.rutaFitxerLog}</a>
</td>
</tr>
until now everything is fine, but what I want to do is once the path is clicked, the file should be downloaded, which i am not able to do with: onClick="descarga([[${applicationDadesVersioBB.rutaFitxerLog}]])
the JavaScript descarga function:
<script type="text/javascript">
function descarga(file)
{
window.location=file;
}
</script>
I think the problem I have is the conversion of java variable values to javascript values.
I tried to do it changing the onClick="descarga([[${applicationDadesVersioBB.rutaFitxerLog}]])" to onClick="descarga("#{applicationDadesVersioBB.rutaFitxerLog}")"
but no way, any help?
which i am not able to do with- why? what's the problem?descarga?