从后台获取一个类,类的定义如下:public class JzBusiness implements java.io.Serializable {
private static final long serialVersionUID = 6568165014358134335L;
private Integer bsId;
private String bsname;
private String comments;
private Integer remindtype;
private Set jzGtypes = new HashSet(0);这里面有个jzGtypes的集合存有jzGtype类。在javascript需要判断jzGtype是否为空,如下:<logic:iterate id="business" scope="request" name="allbusiness" indexId="ind">
if(jzGtypes不为空){
<logic:iterate id="gtype" name="business" property="jzGtypes">
business_id[<%=temp%>]=new Array("${business.bsId}");
gtype_id[<%=temp%>]=new Array("${gtype.gtId}");
gtype_name[<%=temp%>]=new Array("${gtype.gtName}");
remindtype_id[<%=temp%>]=new Array("${business.remindtype}");
<%temp++ ;%>
</logic:iterate>
}else(jzGtype为空){
business_id[<%=temp%>]=new Array("${business.bsId}");
remindtype_id[<%=temp%>]=new Array("${business.remindtype}"); <%temp++ ;%>
}
</logic:iterate>这个如何在javascript写 if(jzGtypes不为空){,谢谢!
private static final long serialVersionUID = 6568165014358134335L;
private Integer bsId;
private String bsname;
private String comments;
private Integer remindtype;
private Set jzGtypes = new HashSet(0);这里面有个jzGtypes的集合存有jzGtype类。在javascript需要判断jzGtype是否为空,如下:<logic:iterate id="business" scope="request" name="allbusiness" indexId="ind">
if(jzGtypes不为空){
<logic:iterate id="gtype" name="business" property="jzGtypes">
business_id[<%=temp%>]=new Array("${business.bsId}");
gtype_id[<%=temp%>]=new Array("${gtype.gtId}");
gtype_name[<%=temp%>]=new Array("${gtype.gtName}");
remindtype_id[<%=temp%>]=new Array("${business.remindtype}");
<%temp++ ;%>
</logic:iterate>
}else(jzGtype为空){
business_id[<%=temp%>]=new Array("${business.bsId}");
remindtype_id[<%=temp%>]=new Array("${business.remindtype}"); <%temp++ ;%>
}
</logic:iterate>这个如何在javascript写 if(jzGtypes不为空){,谢谢!
<c:if test="${jzGtypes!=null}">
或者
if(jzGtypes!=null)还有
if(jzGtypes!=null && jzGtypes!="")
jzGtypes是个类的话,可以严格一点if(typeof jzGtypes!='object')
你不是用的是struts logic标签吗?
那继续用logic标签啊...
logic:empty
logic:notEmpty...
logic:empty
logic:notEmpty...
来判断不就可以了...
或者
logic:empty
logic:notEmpty