In my jsf page I am calling a method called saveinsert and in my saveInsert method I have the following code.
try {
System.out.println("rchd 1");
for (Employees items : editCellItems) {
System.out.println("rchd 2");
items.setEmpId(empBean.getEmployeesId());
System.out.println("after assigning "+items.getEmployeesId());
} catch (Exception e) {
System.out.println("exception "+e.getMessage());
e.printStackTrace();
}
where editCellItems is declared like
List<Employees> editCellItems= new ArrayList<Employees>();
and empBean is declared like this
Employees empBean= new Employees();
My problem is when I run my jsf page rchd 2 and code after that is not getting invoked.
What could be the reason?
Make sure you add values into
editCellItemsusing theList<?>add()meothod. Also When doing a for each loop make sure you do not add or remove items or you will get anException.e.g.:
edit: Also If you only have 1 element in your
editCellItems, you might not want to use a list unless you are adding more,