将jsp.vm修改,添加froeach
<!-- 列表 -->
<div id="right">
<button type="button" class="btn btn-primary" onclick="showAddDiv()">新增</button>
<table class="table table-bordered">
<thead>
<tr>
#foreach(${e} in ${columnList})
<th>${e.columnComment}</th>
#end
<th>删除</th>
<th>编辑</th>
</tr>
</thead>
<tbody>
<!-- EL表达式-翻课本 -->
<!-- List<User> row.id 这个id就是后台传来的User里面的属性名 -->
<c:forEach items="#literal()${#end pageInfo.list }" var="row">
<tr>
#foreach(${e} in ${columnList})
<td>#literal()${#end row.${attrName} }</td>
#end
<td><a href="#" class="btn btn-primary" onclick="deleteUser(#literal()${#end row.id})">删除</a></td>
<td><a href="#" class="btn btn-primary" onclick="edit(#literal()${#end row.id})">编辑</a></td>
</tr>
</c:forEach>
</tbody>
新增的地方也要修改,添加froeach
<div class="box">
<div id="loginDiv">
<p class="logTitle">新增</p>
<div>
<form id="saveForm">
<input type="hidden" name="id" id="id" value="0" />
#foreach(${e} in ${columnList})
<div class="formInput">
<span>${e.columnComment}:</span>
<input type="text" name="${e.attrName}" id="${e.attrName}" />
</div>
#end
<input class="formButton" type="button" value="保存"
onClick="create()" />
</form>
</div>
</div>
</div>
运行 http:/ /localhost:8080/shop/user/list.do
http:// localhost:8080/shop/menu/list.do 这是一个管理页面