[英]Using jQuery/JavaScript Code in JSP
I have jQuery code in a JSP: 我在JSP中有jQuery代码:
${'#userid').val('admin')
The app server is interpreting the jQuery code as JSP: 应用服务器将jQuery代码解释为JSP:
The function val must be used with a prefix when a default namespace is not specified
How do I "escape" the JavaScript? 如何“转义” JavaScript?
There is absolutely no problem in using javascript in jsp pages. 在jsp页面中使用javascript绝对没有问题。
Your example does not work because it is not valid jQuery - instead it starts like an EL expression. 您的示例无效,因为它不是有效的jQuery-而是像EL表达式一样开始。 Your first bracket should not be curly:
您的第一个括号不应是卷曲的:
$('#userid').val('admin')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.