-
Oct 18th, 2010, 06:03 AM
#1
display list of command object
Hi,
I have main command object. And this contains a list of object with fields (with get and set methods and serialized).
Now in JSP, how to display this in spring ?
Example:
class MainCommand implements Serializable{
...
private List<A> myList;
public List getMyList(){ return myList; }
public void setMyList(List list){this.myList = list;}
}
class A implements Serializable{
private String id;
private String firstName;
private String lastName;
...
// with get and set methods
}
Can anyone tell me how to show MainCommand in JSP ?
-
Oct 18th, 2010, 06:24 AM
#2
You might want to display your item in a table; for that, you have basically two options:
- creating the table on your own, using c:forEach to iterate on the elements of the list and produce a table row for every element. This is ok for simple cases, but it offers you no instruments to deal with advanced things your customer will probably ask, like fields formatting, stateful css decoration, column sorting, pagination etc;
- use a framework that "does it for you". There are a lot of table frameworks that let you create tables from list in lke no time, and offer several advanced options like pagination, sorting etc. Some frameworks are based on tags, like DisplayTag, while others are entirely javascript (like jQuery plugin DataTables, to use which you will need to feed the data in either json or xml format).
So, based on your project complexity and/or customer needs, feel free to choose whichever approach suits you most...
-
Oct 18th, 2010, 08:42 AM
#3
Thanks for the reply.
I am just trying out to do this initially proof as the field are less. Later on I will think of using any framework. Thanks.
I w'd like to populate a name value pair from the properties file to the jsp combo box. I am trying to do with title. Is there any spring tag available to load combo box from the properties file list ? or thru' enum ?
Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules