如何用动态值填充特定的 td [英] How to fill particular td's with dynamic values

查看:20
本文介绍了如何用动态值填充特定的 td的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面分享一张图片,显示我有一个 id、详细信息、参数和值的列表值.我可以填写id和详细信息,但无法填写参数和值.

I am sharing an image below that shows i have a list value for id, details,parameter,and values. I am able to fill in the id and details, but failed to fill parameter and value.

下面是用于创建我传递给控制器​​的列表的 java 类.我正在获取值,但无法在 td 中显示:

Below is the java class for creating a list which i passed to controller. I am getting the value but cant display in it in 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>

谁能告诉我如何解决这个问题?非常感谢您的建议和帮助.

Can anyone tell how this issue can be fixed? Thank You So much in advance for yours suggestion and help.

推荐答案

Try to use not empty inatead of !empty 来验证 if 条件如下:

Try to use not empty inatead of !empty toverify the if condition like this:

  <c:if test="${ not empty listRule1}">

这篇关于如何用动态值填充特定的 td的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆