<c:forEach items="${requestScope.schoolList.resultList}" var="re" varStatus= "status "><c:if test="status.index % 2 == 1">  <tr>
  <td width="297" height="201"><img src="upload/${re.swphoto}" height="106" width="181"/></td></c:if><c:if test="status.index % 2 == 0">  <td width="290"><img src="upload/${re.swphoto}"></td>
  </tr></c:if>  </c:forEach>

解决方案 »

  1.   

    是不是一行显示两个的?
    <c:forEach items="${requestScope.schoolList.resultList}" var="re" varStatus= "status">
    <c:if test="status.index % 2 == 0">
      <tr></tr>//换一行
    </c:if>
    <tr>
      <td width="297" height="201">
       <img src="upload/${re.swphoto}" height="106" width="181"/>
      </td>
    </tr>
    </c:forEach>
      

  2.   

    这不能叫一次输入两个~~ 还是一 个一个输出 只是输出的时候有奇偶判断而已 
    <c:forEach items="${requestScope.schoolList.resultList}" var="re" varStatus= "status "><c:if test="status.index % 2 == 1">  <tr>
      <td width="297" height="201"><img src="upload/${re.swphoto}" height="106" width="181"/></td></c:if><c:if test="status.index % 2 == 0">  <td width="290"><img src="upload/${re.swphoto}"></td>
      </tr></c:if>  </c:forEach>
      

  3.   

    <tr>
    <c:forEach items="${requestScope.schoolList.resultList}" var="re" varStatus= "status">
    <c:if test="status.index % 2 == 0">
       </tr>
       <tr>//换一行
    </c:if>
       <td width="297" height="201">
           <img src="upload/${re.swphoto}" height="106" width="181"/>
       </td>
    </c:forEach>
    </tr>
      

  4.   

    <c:if test="status.index % 2 == 1">?? 可以这样写?  <c:if test="${status.index % 2 eq 1}">
      

  5.   

      
    这是一行显示2个 在一个span中的2个链接
     <div class="topLoop">
    <div class="bd">
    <ul class="infoList blacks">
    <c:forEach items="${newsList}" var="news_li" varStatus="i_li">
    <c:if test="${i_li.index % 2 eq 0}">
    <li>
    <c:forEach items="${newsList}" var="news_span" varStatus="i_span" begin="${i_li.index}" end="${i_li.index + 1}">
    <span class="l_a"><a href="${news_span.bullURL}" title="${news_span.bullName}" target="_blank" style="display:block;">${news_span.bullName}</a></span> 
    </c:forEach>
    </li>
    </c:if>
    </c:forEach>
    </ul>
    </div>
    </div>
      

  6.   

    foreach 是遍历用的,请问你要干啥啊?