【问题标题】:how could i display the dynamic value in a html table我如何在 html 表中显示动态值
【发布时间】:2016-04-06 20:43:49
【问题描述】:

我有一个从列表中检索的数据,我想将它们准确地放置在我该如何做到这一点,请给出一个有用的建议。

创建列表的java类

import java.util.ArrayList;
import com.demo.Rules;

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);

}

公共 ArrayList getRules(){

返回a1;

}

}

控制器

@RequestMapping(value = "/compplan", method = RequestMethod.GET)
public String listRules1(ModelMap model) {
    CompArray obj1 = new CompArray();
    model.addAttribute("listRule1", obj1);
    return "hello";
}

HTML

<c:if test="${!empty listRule1}">
                <table  border ="2">
                    <tr>
                        <th align="center"><b>ID</b></th>
                        <th align="center"><b>Details </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>

我正在这样做,但它没有在表格中显示值,请帮助我。

提前致谢

【问题讨论】:

    标签: java html spring


    【解决方案1】:

    把这个&lt;c:if test="${!empty listRule1}"&gt;改成&lt;c:if test="${not empty listRule1}"&gt;试试看

    【讨论】:

    • 先生,您能告诉我一些细节吗???
    • jstl中基本上不能使用!操作符,而需要使用not这个词
    猜你喜欢
    • 2014-02-25
    • 2015-02-16
    • 1970-01-01
    • 2018-12-16
    • 2017-05-11
    • 1970-01-01
    • 2017-01-17
    • 1970-01-01
    • 2022-01-20
    相关资源
    最近更新 更多