检查变量是否为真 [英] checking whether the variable is true or not
本文介绍了检查变量是否为真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function add(){
<%if(empRecNum != null && !(empRecNum.equals("")))
{
empSelected=true;
}
boolean canModify = UTIL.hasSecurity("PFTMODFY") && empSelected;
%>
df('ADD');
}
当我单击添加时,我需要检查empSelected是否为true并传递此canModify值.会叫吗?
When i click on add, i need to check whether the empSelected is true or not and pass this canModify value. Will this be called?
以这种正确的方式检查JavaScript中的Scriptlet
Is this right way i am checking a Scriptlet inside a JavaScript
推荐答案
在JSP中定义的canModify
值永远不会传递给JavaScript.您需要在JavaScript中重新定义变量,例如:
The canModify
value defined in JSP is never passed to JavaScript. You need to redefine the variable in JavaScript, for example:
<%
if (canModify) { // This is the JSP variable
%>
var canModify = true; // This is the JavaScript variable
<%
} else {
%>
var canModify = false;
<%
}
%>
另一方面,您应该放弃JSP scriptlet并切换到JSTL.
On a different note, you should abandon JSP scriptlets and switch to JSTL.
这篇关于检查变量是否为真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文