Bogdan Bogdan - 6 months ago 8
SQL Question

How to call a parameter into a js from servlet

I want to pass value of a parameter from servlet into

js
function.
Here is my java code:

double nota = rs1.getDouble(1);
request.setAttribute("nota",nota);


Here is how I call into
js
:

<script>
rate (${nota})
</script>


But I'm getting this error:

Multiple annotations found at this line:

- Syntax error on tokens, delete these
tokens
- Syntax error on token(s), misplaced
construct(s)


Could anyone help me? I' m new to
js
. Thanks.

Answer

Add "" :

<script type="text/javascript">
        rate("${nota}"); 
</script>
Comments