jsp页面使用el表达式循环list集合,不是按照顺序展示

叶熊吧 2016-11-26 09:08:52
使用springmvc框架做个了简单项目,查询菜单时发现查询出的数据和页面展示数据顺序不一致;
后台sql执行:
	<select id="selectMenuList" parameterType="com.lw.model.system.MenuBean" resultType="com.lw.model.system.MenuBean">
SELECT A.MENU_ID,
DECODE (A.GRADE, 1, A.MENU_NAME, 2, '-' || A.MENU_NAME)
AS MENU_NAME,
A.MENU_URL,
A.MENU_DESC,
A.PARENT_ID,
A.MENU_IMAGE,
A.ORDER_NUM,
A.GRADE,
A.FLAG
FROM tb_menu A
START WITH A.parent_id = 0 AND A.FLAG = 0
CONNECT BY NOCYCLE PRIOR A.menu_id = A.parent_id AND A.FLAG = 0
ORDER SIBLINGS BY A.ORDER_NUM DESC
</select>

查询出来的数据集是
Controller代码如下;
	@RequestMapping(value = "/selectMenuList", method = RequestMethod.GET)
public ModelAndView showMenuList(HttpServletRequest request,MenuBean menuBean) {
ModelAndView mv = this.getModelAndView();

List<MenuBean> menuList = null;
try {
menuList = menuService.queryMenuList(menuBean);

} catch (Exception e) {
e.printStackTrace();
}
mv.addObject("menuList", menuList);
mv.addObject("menu", menuBean);
mv.setViewName("system/menu_list");
return mv;
}

数据查询后,未做任何操作到Controller层,debug模式下,上图中menuList 里的数据还是有序的,和sql执行结果一直,可在jsp上循环出的结构就变了

代码如下:
<table
class="table table-border table-bordered table-bg table-hover table-sort">
<thead>
<tr class="text-c">
<th width="25"><!-- <input type="checkbox" name="" value=""> --></th>
<th width="200">菜单编号</th>
<th width="250">菜单名称</th>
<th width="300">菜单地址</th>
<th width="200">描述</th>
<th width="60">状态</th>
<th width="120">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${menuList}" varStatus="i" var="item">
<tr class="text-c">
<td><input type="checkbox" value="" name=""></td>
<td>${item.menuId}</td>
<td>${item.menuName}${i.index}</td>
<td>${item.menuUrl}</td>
<td>${item.menuDesc}</td>
<td class="td-status" align="center">
<c:if test="${item.flag eq '0'}">
<span class="label label-success radius">使用</span>
</c:if>
<c:if test="${item.flag eq '1'}">
<span class="label label-success radius">禁用</span>
</c:if>
</td>
<td class="f-14 td-manage">
<a style="text-decoration: none" class="ml-5" onClick="show_edit('编辑','./editMenuInit.do?menuId=${item.menuId}','10001')" href="javascript:;" title="编辑">
<i class="Hui-iconfont"></i>
</a>
<a style="text-decoration: none" class="ml-5" onClick="show_del(${item.menuId})" href="javascript:;" title="删除"><i class="Hui-iconfont"></i></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>

这是怎么回事啊
...全文
1022 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_36118244 2019-01-25
  • 打赏
  • 举报
回复
到底啥原因?????
lw_jun 2016-11-26
  • 打赏
  • 举报
回复
应该是dataTables.js影响的,具体为什么还不清楚
叶熊吧 2016-11-26
  • 打赏
  • 举报
回复
是框架的问题,已找到原因

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧