用于创建规则列表的Java类
public class CompArray {
public ArrayList<Rules> a1= new ArrayList<Rules>();
public CompArray (){
Rules rul = new Rules();
rul.setruleId("1001");
rul.setruleName("khagfkj");
rul.setParameter("lsrkjglkrs");
rul.setValue("lskdjfk");
a1.add(rul);
}
public ArrayList<Rules> getRules(){
return a1;
}
规则列表控制器
@RequestMapping(value = "/demo", method = RequestMethod.GET)
public String listRules1(ModelMap model) {
CompArray obj1 = new CompArray();
model.addAttribute("listRule1", obj1.a1);
return "hello";
}
html表我希望将动态值放在列中
<c:if test="${not empty listRule1}">
<table border ="2">
<tr>
<th align="center"><b>Rule ID</b></th>
<th align="center"><b> Rule Name </b></th>
<th align="center"><b>Rule Type </b></th>
<th align="center"><b>Rule Validity </b></th>
<th align="center"><b>Parameter </b></th>
<th align="center"><b>Value</b></th>
</tr>
<c:forEach items="${listRule1}" var="obj1">
<tr>
<td>${obj1.id}</td>
<td>${obj1.details}</td>
<td>${obj1.parameter}</td>
<td>${obj1.value}</td>
</tr>
</c:forEach>
</table></c:if>
如何将动态值放在特定列中? 请有人帮我做这个..我尝试了很多解决方案,但无法解决这个问题。
答案 0 :(得分:0)
再添加两个tds,如下所示。
<td>${obj1.id}</td>
<td>${obj1.details}</td>
<td></td>
<td></td>
<td>${obj1.parameter}</td>
<td>${obj1.value}</td>