Displaying Map on JSP -
i have map of account objects need display on jsp. have followed procedure ui doesn't display table contents @ all. advise helpful. below code : bean : account.java ( id,name,renewwaldate,balance,equityallocation) controller :
@requestmapping(method = requestmethod.get) public string getlist(modelmap model) { (iterator = accounts.keyset().iterator(); it.hasnext();) { object key = it.next(); account value = accounts.get(key); system.out.println("key : " + key + "value : " + value.getname() + value.getbalance() + value.getequityallocation() + value.getrenewaldate() +value.getid()); } system.out.println(accounts); model.addattribute(accounts); return "account/list"; }
jsp snippet :
<h3>list of accounts</h3> <form:form modelattribute="accounts" method="post"> <table> <c:foreach var="donor" items="${accounts}"> <tr> <td align="right">${donor.key}</td> <td align="right">${donor.value.name}</td> <td align="right"> ${donor.value.balance}</td> <td align="right">${donor.value.equityallocation}</td> <td align="right">${donor.value.renewaldate}</td> </tr> </c:foreach> </table>
you should pass attribute name accounts, example model.addattribute("accounts", accounts);
Comments
Post a Comment