for(int i=0;i<10;i++){}向这种在JSP页面怎么搞????????

解决方案 »

  1.   


    <%
    for(int i=0;i<10;i++){
    %>
    i: <%=i %>
    <%
    }
    %>
      

  2.   

    struts 标签或C标签都可以 或JSP代码
      

  3.   

    <c:foreach var="l" items="${list}">
    ${l}
    </c:foreach>
      

  4.   

    <c:forEach var="model" items="modelList">
    </c:forEach>
      

  5.   

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><c:forEach var="score" items="${scoreList}">
    ${score}
    </c:forEach>
      

  6.   

    <c:forEach var="l" items="9-paginationSupport2.items.size" >
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </c:forEach>
      

  7.   

    <c:forEach var="l" items="9-paginationSupport2.items.size" >这只能是集合啊 数字不行
      

  8.   


     <c:forEach varStatus="stauts" begin="0" end="9">
        ${stauts.count}
        </c:forEach>
      

  9.   

    <c:forEach begin="1" end="10" step="1">
    a
    </c:forEach>
    打印10个a
      

  10.   

    <s:if test="paginationSupport2.items.size<9">
    <c:forEach varStatus="stauts" begin="paginationSupport2.items.size" end="9">
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
     </c:forEach>
    </s:if>我这样写的出错
    严重: Servlet.service() for servlet jsp threw exception
    java.lang.NumberFormatException: For input string: "paginationSupport2.items.size"
      

  11.   

    paginationSupport2.items.size什么东西
      

  12.   

    在<%%>里可以写java语句,你试试吧
      

  13.   

    你先注掉下面的、看看你的paginationSupport2.items.size能打印不
    <%=paginationSupport2.items.size%>
      

  14.   

    <s:if test="paginationSupport2.items.size<9">
    <c:forEach varStatus="stauts" begin="paginationSupport2.items.size" end="9">
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </c:forEach>
    </s:if>
    换成
    <%=paginationSupport2.items.size%>
      

  15.   

    楼主可以把问题解说的再细点。
    另:可以参考下jstl标签的<c:forEach>