I have searched several examples, still have not get. I am passing an List of GOOD object from controller into jsp pages. trying to loop over the list object, but its showin
use this code to pass list
request.setAttribute("listGood",listg);
My guess is that your controller is doing the following:
Good g = new Good();
List<Good> goods = new ArrayList<Good>();
for (int i = 0; i < 4; i++) {
g.setName("a");
...
goods.add(g);
}
This means that you're modifying the same Good object 4 tilmes, and adding it 4 times to the list. In the end, your have 4 times the same object, containing the state you set into it in the last iteration.
Instead, do this:
List<Good> goods = new ArrayList<Good>();
for (int i = 0; i < 4; i++) {
Good g = new Good();
g.setName("a");
...
goods.add(g);
}
EDIT : and your edited question just confirmed my guess:
ListGoodsForm listo = new ListGoodsForm();
this line should be inside the for loop, and not outside.