Passing variable from JSP to Javascript

后端 未结 5 1030
梦谈多话
梦谈多话 2020-12-03 21:52

I know there is already questions about that, but I just can´t simply get this work, I have a JSP file with a java variable in it:

String test = \"Hello\";

5条回答
  •  清歌不尽
    2020-12-03 22:38

    The best way to do it is to use something like following in your javascript code;

    var myvar = '${jspvar}';
    

提交回复
热议问题