Frage

I wonder how you get to run the JavaScript framework chartjs in jsp. In the options section of the bar chart there is this line:

//Interpolated JS string - can access value
scaleLabel : "<%=value%>",

but <%= and %> are JSP tags. So how do you get to run it properly? Also, are there any other issues?

War es hilfreich?

Lösung

You do not need to specify the default if you want the default, so try deleting the line in question.

If you wish to keep it exactly, it must be escaped because the correct JavaScript here has a JSP Expression in it.

You can escape it with a JSP Expression.

scaleLabel : "<<%= "%=value%" %>>",

You can escape it with a JSP EL Expression.

scaleLabel : ${ '"<%=value%>"' },

Another option is to use equivalent JavaScript that does not contain a JSP Expression.

scaleLabel : "<" + "%=value%" + ">",
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top