rendering data in jsp using spring controllers and different classes -
i want render data
this how jsp page table
how achieve this,
please me,
it creates lot of confusion me, how many classes define , fields.
thanks
most data coming database , kind of list
of javabeans returned.
let's is:
list<myobjects> objects
you need set in controller level:
@requestmapping(value="/table") public modelandview rendertable() { modelandview mv = new modelandview("/table"); mv.add("objects",objects); return mv; }
now way render on jsp:
<c:if test="${not empty objects}"> <table> <c:foreach var="o" items="${objects}"> <tr> <td>${o.id}</td> <td>${o.name}</td> <td>${o.descriptio}</td> </tr> </c:foreach> </table> </c:if>
you can read more here: http://static.springsource.org/spring/docs/3.0.1.release/reference/html/view.html
Comments
Post a Comment