【发布时间】:2016-04-06 21:51:36
【问题描述】:
我在下面分享一张图片,显示我有一个 id、详细信息、参数和值的列表值。我可以填写id和详细信息,但无法填写参数和值。
下面是 java 类,用于创建我传递给控制器的列表。我得到了价值,但无法在 td 中显示:
public class CompArray {
public ArrayList<Rules> a1= new ArrayList<Rules>();
public CompArray (){
Rules rul = new Rules();
rul.setId("1001");
rul.setDetails("khagfkj");
rul.setParameter("lsrkjglkrs");
rul.setValue("lskdjfk");
a1.add(rul);
}
public ArrayList<Rules> getRules(){
return a1;
}
控制器
@RequestMapping(value = "/compplan", method = RequestMethod.GET)
public String listRules1(ModelMap model) {
CompArray obj1 = new CompArray();
model.addAttribute("listRule1", obj1.a1);
return "hello";
}
html
<c:if test="${!empty listRule1}">
<table border ="2">
<tr>
<th align="center"><b>Rule ID</b></th>
<th align="center"><b> Rule Details </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>
谁能告诉我如何解决这个问题? 非常感谢您的建议和帮助。
【问题讨论】:
-
拜托我需要帮助来做这件事,请帮帮我