当然可以,用logic:present用标签,和你的判断一样,只不过不像你那样,就写一个</logic:iterate>,这个药都写上<logic:present name="nlist">
<logic:iterate id="course" name="nlist" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
......
</logic:iterate> 
</logic:present>
<logic:notPresent name="nlist">
<logic:iterate id="course" name="mcList" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
....
</logic:iterate> 
</logic:notPresent>

解决方案 »

  1.   

    因为我的
    .... 一直到</logic:iterate>的内容非常长而且两部分完全一样,所以能否只区别<logic:iterator...头部,其它用一个
      

  2.   

    <% 
      ArrayList nlist=request.getAttribute("nlist"); 
      if(nlist!=null) { 
    %> 
    <logic:iterate id="course" name="nlist" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index"> 
    <%} else {
      ArrayList mcList=request.getAttribute("mcList"); 
    %> 
    <logic:iterate id="course" name="mcList" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index"> 
    <%}%> .... 
    </logic:iterate> 
    参照以上程序改一下,试试!
    我感觉你的mcList应该为null 所以应该是空指针异常!
      

  3.   


    请按照规定写,你说的头比较多,如果你用嵌入java代码写,自己感觉一下哪个更乱,节省了</logic:iterate>,引入了一大堆的<%xxx
    而且容易出错,自己考虑