window.open()在JSP中传递变量时不起作用

window.open() is not Working when Passing variable in JSP

本文关键字:变量 不起作用 JSP open window      更新时间:2023-09-26

在过去的两天里,我一直忙于我的项目。我正在中使用window.open()用于按钮类型输入的Jsp。作为:-

HTML

     <td colspan="2" align="right"><input type="button" value="Report" id="btn1" 
     onclick="window.open('<%= url %>')"></td>  

但当我在window.open中url的位置传递String时,它就可以正常工作了。

Javascript:

    onclick="window.open('<%= "http://www.google.com" %>')"

请帮帮我,提前感谢

代码没有问题。希望你之前已经初始化过url。变量url可能为空。