Error : java.util.ConcurrentModificationException

后端 未结 3 1876
情歌与酒
情歌与酒 2020-12-22 06:34

i have a grid from where users select the row , when a row is clicked then its id is sending to my action class AddBookToSession.java and after wards it is retu

3条回答
  •  长情又很酷
    2020-12-22 07:25

    It is possible that the page is refreshed around the time your code executes "books.add(book);" in which case you will get the exception as you are modifying a collection at same time someone else is using it.

    Is it possible to modify your code so that the "books" you modify in the AddBookToSession is copy of the internal list of books.

    books = new ArrayList((ArrayList) session.get(BillTransactionBooksConstants.BOK););
    

提交回复
热议问题