我靠这么复杂,将你的树的tag看看,先!!

解决方案 »

  1.   

    我想难点是怎么用jsp技术实现类似java code中方法的递归调用
    public method {
       ....
       method();
    }
    这里的method在jsp中相当与显示一个节点的页面片断。
      

  2.   

    可以考虑做成一个java bean来处理啊!
      

  3.   

    奇怪了 
    你写个类里面实现递归,然后返回字符串
    然后在jsp中调用显示不就完了么,咋 这么费劲
      

  4.   

    可以用import来实现你要达到的效果,例如: <c:choose>
        <c:when test="${empty param.recursion}">
          <table>
             <c:forEach var="catalog" items="${catalogList}">
                <c:set var="catalog" scope="request" value="${catalog}"/>
                <c:set var="depth" scope="request" value="0"/>
                <c:import url="/WEB-INF/pages/pickCatalog.jsp?recursion=true"/>
             </c:forEach>
          </table>
        </c:when>
        <c:otherwise>
             <c:choose>
                  <c:when test="${catalog.leafCatalog}">
                        <c:if test="${status.index%5==0}">
                        <tr>
                        </c:if>
                          <td>
                            <c:if test="${status.index%5==0}">
                                <c:forEach begin="0" end="${depth}" step="1">
                                   &nbsp;
                                </c:forEach>
                            </c:if>
                                <html-el:multibox name="${param.form}" property="${param.property}" styleId="${catalog.id}">
                                    <c:out value="${catalog.id}"/>
                                </html-el:multibox>
                                <c:out value="${catalog.name}"/>
                          </td>
                        <c:if test="${status.index%5==5-1||status.last}">
                        </tr>
                        </c:if>
                  </c:when>
                  <c:otherwise>
                        <tr>
                          <td>
                            <c:forEach begin="0" end="${depth}" step="1">
                               &nbsp;
                             </c:forEach>
                            <b><c:out value="${catalog.name}"/></b>
                          </td>
                        </tr>
                  </c:otherwise>
            </c:choose>        <c:forEach var="child" items="${catalog.children}" varStatus="status">
                <c:set var="catalog" scope="request" value="${child}"/>
                <c:set var="depth" scope="request" value="${depth+1}"/>
                <c:set var="status" scope="request" value="${status}"/>
                <c:import url="/WEB-INF/pages/pickCatalog.jsp"/>
                <c:set var="depth" scope="request" value="${depth-1}"/>
            </c:forEach>
        </c:otherwise>
    </c:choose>