[英]How can I check more than two conditions inside oncomplete
I have 4 conditions to check, I want to check it inside oncomplete statement. 我有4个条件要检查,我想在oncomplete语句中检查它。 I recognized that I can check only two using if else.
我认识到,如果使用其他方法,则只能检查两个。 If I use if -> else if -> else if -> else if to check 4 conditions in oncomplete.
如果我使用if-> else if-> else if-> else if在oncomplete中检查4个条件。 When I did that it can check only if and else if (again 2 conditions only) Is any way to check more than two conditions?
当我这样做时,它只能检查是否以及是否(仅再次满足2个条件)是否可以检查两个以上条件? That's my code.
那是我的代码。 That code can check only if and 1st else if
该代码只能检查if和1st else
<a4j:commandLink .....
action ....
oncomplete=" if (1st condtition ) ; else if (2nd condition) ; else if (3th condition ) ; else if (4th condition)"
Any ideas? 有任何想法吗?
If u want to check for true
如果你想检查
true
if(1st condition && 2nd condition && 3rd condition && 4th condition){}
or any one true
或任何一个
true
if(1st condition || 2nd condition || 3rd condition || 4th condition){}
I find out an answear for my own question. 我为自己的问题找到了答案。 I will explain that in the answear of it.
我会在后面对此进行解释。 But i will explain my problem more properly for you and all guys who will read it anytime.
但是,我将为您和所有随时阅读此书的人更恰当地解释我的问题。 So: I have a .xhtml file , where i am using Seam framework and JSF to connect front-end and back-end side of my project.
所以:我有一个.xhtml文件,我在这里使用Seam框架和JSF连接项目的前端和后端。 Also i am using AJAX.
我也正在使用AJAX。 I have the which is containing in body : onclick , action , oncomplete , rendered .
我的正文中包含:onclick,action,oncomplete,rendered。 So in oncomplete i wanted to check 4 different condtitions , depends of result i wanted to call an method from some java class.
所以在oncomplete上,我想检查4个不同的条件,根据结果,我想从某个Java类中调用一个方法。 But oncomplete supports only if else.
但是oncomplete仅在其他情况下支持。 – svennnx3 3 mins ago Edit
– svennnx3 3分钟前编辑
And i wanted to use if else if , else if , else if. 我想使用if if if,else if,else if。 It not gonna work unfrotunately.
它不会毫不费力地工作。 So i only did 2 condtitions ( if and else).
所以我只做了2个条件(如果是,否则)。 my methods just set 2 boolean variables.
我的方法只是设置2个布尔变量。 Then i am calling to show an dialog window when my booleans are true.
然后,我打电话给我的布尔值为true时显示一个对话框窗口。 That solves my problem, to show two dialogs at once or only 1 when only one variable is true :)
这就解决了我的问题,一次只显示两个对话框,或者当只有一个变量为true时只显示1个对话框:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.