[英]Script mediator with for loop in wso2 esb
I tried to use for loop inside the script mediator. 我试图在脚本介体中使用for循环。 Here is my attempt
这是我的尝试
<script language="js"><![CDATA[
var cars = ["BMW", "Volvo", "Saab", "Ford", "Fiat", "Audi"];
var i;
var text = "";
for(i=0 ; i< cars.length;i++){
text+ = array[i]+ "<br>";
}
]]></script>
But when I going to save this It show error. 但是当我要保存它时,它显示错误。 But when I remove for loop its work fine.
但是当我删除for循环时,它的工作正常。 What is the wrong.
怎么了 Can't I add for loop inside script mediator.
我不能在脚本介体中添加for循环。
Then otherwise I tried to use foreach mediator.There also have some problem with me.How can I solve this problem. 然后否则我尝试使用foreach介体。我也有一些问题 ,我该如何解决这个问题。 Thank you
谢谢
You have a space between + and = which is a syntax error because you can't have a + in the variable name. 在+和=之间有一个空格,这是语法错误,因为变量名中不能有+。
The line should read: 该行应显示为:
text += array[i]+ "<br>";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.