kkloqin 2016-05-10 08:45 采纳率: 50%
浏览 1558
已结题

jsp中使用iterator的内容无法显示出来,代码中哪里出现错误,见图

 <%@ 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模式下显示
![图片说明](https://img-ask.csdn.net/upload/201605/10/1462869892_664690.png)
  • 写回答

2条回答 默认 最新

  • -缘故- 2016-05-13 06:01
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致