java - Struts IndexOutOfBoundsException when assign one entity list value to another -
list<entitylist> listentitylists = new arraylist<entitylist>(); list<matcheventlevel2> eventlevel2s = new arraylist<matcheventlevel2>(); public string createview() { eventlevel2s = getdaofactory().getmatcheventlevel2dao().findallactive(); (int = 0; < eventlevel2s.size(); i++) { listentitylists.get(i).settname( eventlevel2s.get(i).getteama().getteamid().gettname() + "v/s" + eventlevel2s.get(i).getteamb().getteamid() .gettname()); } return create_view; } catch (exception e) { e.printstacktrace(); return error; } }
i fetching 1 list matchevent , assign property of list listentitylists
has 2 property id
, tname
, setting 2 property. debugg code bebugg pointer moves in loop , throws indexoutofboundsexception : index: 0, size: 0
can 1 tell me problem?
your listentitylists empty. need fill before doing get(i) on it.
Comments
Post a Comment