i sharing image below shows have list value id, details,parameter,and values. able fill in id , details, failed fill parameter , value.
below java class creating list passed controller. getting value cant display in 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; }
controller
@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 tell how issue can fixed? thank in advance yours suggestion , help.
try use not empty
inatead of !empty
toverify if condition this:
<c:if test="${ not empty listrule1}">
Comments
Post a Comment