您的位置:首页 > Web前端 > JavaScript

Jsp页面无法显示List数值debug4天经历-dayOne

2013-01-10 16:10 267 查看
Day one : 参照别人项目的源码 写了一个自己的foreach循环, 用来取类的值

项目背景:

struts 2 + spring + mybatis;

<div class = content-box style="height: 816px; ">

<div class="product-list">

<table width="100%" id="product-table">

<tr>

<th width="6%">角色ID</th><th width="6%">账号ID</th><th width="6%">角色名</th><th width="6%">等级</th>

</tr>

<c:forEach var="Role" items="${RoleList}">

<tr>

<th>${Role.id}</th>

<th>${Role.accountId}</th>

<th>${Role.name}</th>

<th>${Role.level}</th>

<th>${Role.isOnline}</th>

</tr>

</c:forEach>

</table>

</div>

运行程序jsp 页面没有显示。debug 显示foreach循环会执行两次。但是内容没有输出 。

发现无效以后,我决定按照习惯取jsp页面中request的值,确认roleList 内容是否传到jsp 页面。

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

List <Role> RoleList = (List)<Role> request.getAttribute("roleList");

%>

debug 得知request 确实取到了roleList的值 。

对比参照的项目源码与我的页面代码,参照项目多了分页代码,我决定把分页代码抄袭过来,看看是否凑效。(这个一个明显愚蠢的行为)。

加入分页代码list 仍然不能显示 ,下班回家 。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐