2 u012636632 u012636632 于 2016.05.10 16:45 提问

jsp中使用iterator的内容无法显示出来,代码中哪里出现错误,见图 10C
 <%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=x-gbk"></meta>
<title>BBS论坛</title>
<link rel="stylesheet" type="text/css" href="css/style_1_common.css"></link></head>
<body>
<DIV class=wrap>
        <DIV id=menu><SPAN class=avataonline>
        <A href="register.jsp">注册</A> 
        <s:if test="#session.username != null">
            ${username}欢迎你!
        </s:if>
        <s:else>
            <A href="login.jsp">登录</A> 
        </s:else>
        </SPAN> </DIV>
        <DIV class=ad_text id=ad_text></DIV>




        <s:iterator value="map" var="oneItem">

        <div class="mainbox forumlist">
            <span class="headactions">
                                <img src="image/collapsed_no.gif" alt="收起/展开" name="category_1_img" width="8" height="9" id="category_1_img" title="收起/展开" onclick="toggle_collapse('category_1');"/>           </span>
            <h3 align="left"><s:property value="#attr.oneItem.key.itemName"/></h3>
                <table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="10%">&nbsp;</td>
                    <td width="79%"><s:property value="#attr.oneItem.key.itemDescription"/></td>
                    <td width="11%"><span class="moderators">栏目版主: <s:property value="#attr.oneItem.key.manager.username"/></span></td><!--栏目版主-->
                  </tr>
                </table>

            <table id="category_1" summary="category1" style="" cellpadding="0" cellspacing="0">
                <thead class="category">
                    <tr>
                        <th>子栏目</th>
                        <td class="nums">帖子数目</td>
                        </tr>
                </thead>

                <s:iterator value="#attr.oneItem.value" var="ontItems">

                <tbody id="forum38">
                        <tr>
                            <th class="new">
                            <h2><a href="showAllTopic.action?subItemID=<s:property value='#attr.ontItems.subItemID'/>&currentPage=1"><s:property value="#attr.ontItems.subItemName"/></a></h2><!--子栏目标题-->
                            <p><s:property value="#attr.ontItems.itemDescription"/></p>
                            <p class="moderators">版主: <s:property value="#attr.ontItems.manager.username"/></p> 
                            </th>
                            <td class="nums"><s:property value="#attr.ontItems.topics.size()"/></td>
                        </tr>
                </tbody>
                </s:iterator>
          </table>
        </div>
        </s:iterator>


<div id="footer">
  <div align="center">BBS论坛系统~~~~~&copy;2009-2010 </div>
</div>
</body></html>

图片说明

jsp的design模式下显示
![图片说明](http://img.ask.csdn.net/upload/201605/10/1462869892_664690.png)

2个回答

wangmanjie
wangmanjie   2016.05.13 14:01

你把 var 改成id 试试,同时吧attr去掉

wangmanjie
wangmanjie   2016.05.13 14:02
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!