I am trying to add an object into an ArrayList stored in the session.
The object doesn't seem to be added.
Please check my below code and suggest me a correct answer for this.
While debugging my debugger goes till this code books.add(book); and then it skips the remaining code. I know problem is here books.add(book); . Book detail is not adding into my arraylist books.
AddBookToSession.java
    public class AddBookToSession extends ActionSupport {
         Bookdetails book=new Bookdetails();
            List<Bookdetails> books = new ArrayList<Bookdetails>();
            BookdetailsDAO dao = new BookdetailsDAO(); 
      Map session = ActionContext.getContext().getSession();
        public String execute()
        { 
            HttpServletRequest request = ServletActionContext.getRequest();  
            String bookid = request.getParameter("bid");    
            books = (List) session.get( BillTransactionBooksConstants.BOK ); 
          for(int i=1;i<=1;i++)
        {
          book = dao.listBookDetailsById(Integer.parseInt(bookid));    
          books.add(book); //problem is here obj book is not adding into books list
          books = new ArrayList<Bookdetails>();
          System.out.println("---------------Bookid-"+book); 
        }
        ....................
                ...............
struts.xml
        <package name="testwithrowselect" extends="struts-default" >  
                    <action name="InsertbooksToSession" class="v.esoft.actions.booktransaction.AddBookToSession">
                        <result name="success">/jspHomepage/bookstransaction/shortBill.jsp</result>  
                    </action>
         </package>
 
    