判断<c:if>中数据库的取值,但是总是判断不到
'<div class="contents">'
+'<c:if test="${list[i].attribute06 ne null}" >'
+'<fieldset>'
+'<legend>'
+list[i].attribute06 
+'</legend>'
+'</fieldset>'
+'</c:if>'
+ '<span class="pre">'
+ list[i].content
 + '</span>'
  + '</div>'
 想让他判断数据库的数据为空时时fieldset不显示,只有不为空才显示,list是为了循环遍历,但是为什么怎么写都会在为空时fieldset显示为null

解决方案 »

  1.   

    list[i].attribute06 ne null,第二行这是什么意思?
      

  2.   

    <c:if test="${list[i].attribute06 ne null}" >改成不等于试下?
    <c:if test="${list[i].attribute06 != null }" >
      

  3.   


    这个就是,list是把数据库中attribute的值循环遍历出来,因为值有很多个,让他循环,我的想法是,判断如果他的值不等于空,才能运行<c:if>中间的语句,但是现在怎么弄他都会运行中间语句
      

  4.   

    ‘null’,加个引号试试。
      

  5.   

    <c:if test="${ list[i].attribute06  != ''  && list[i].attribute06  != null }">
      

  6.   

    使用<c:if>或者foreach的时候要引用一个uri地址,同时因为我之前是在JS写的div界面,在JSP引入URI无法运行,我把界面从JS换到了JSP就可以了