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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -