[英]forEach loop for String array
I have a string array(APN) in my bean(accessed as header). 我的bean中有一个字符串数组(APN)(作为标头访问)。 I am accessing it like this
我正在这样访问
<c:forEach var="apn" items="${header.APN}" >
var g = apn;
if (g.length!=0 && g!="null"){
if(counter == 1){
count=0;
$("#img0").show();
$("#apn0").show();
$("#rtu0").show();
}
if(counter == 2){
count=1;
$("#img0").hide();
$("#apn0").show();
$("#rtu0").show();
$("#img1").show();
$("#apn1").show();
$("#rtu1").show();
$("#removeimg1").show();
}
if(counter == 3){
count=2;
$("#img0").hide();
$("#apn0").show();
$("#rtu0").show();
$("#img1").hide();
$("#apn1").show();
$("#rtu1").show();
$("#removeimg1").hide();
$("#img2").show();
$("#apn2").show();
$("#rtu2").show();
$("#removeimg2").show();
}
}
</c:forEach>
When I keep an alert after 当我保持警惕之后
var g = apn;
Alert is not popped up. 警报不会弹出。 I have some text boxes in my UI.
我的UI中有一些文本框。 When I press on + icon(rendered in the form of image), another set of text boxes appear to enter multiple values.
当我按+图标(以图像形式呈现)时,出现另一组文本框,以输入多个值。 My code is not working.
我的代码无法正常工作。 Can anyone help me out
谁能帮我吗
Seems you need an }
just before /c:out
. 似乎您需要在
/c:out
之前使用}
。 I don't know if this is the cause of your problem, i just noticed it. 我不知道这是否是您的问题的原因,我只是注意到了。
I think your assignation part is incorrect. 我认为您的分配部分不正确。 Try this -
尝试这个 -
var g = ${apn};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.