I have this code :
private String delete(HttpServletRequest req, HttpServletResponse res, Seller seller) throws Exception {
//check data
if(req.getParameter("equipmentId") == null) {
throw new Exception("equipmentId undefined");
}
//build
Equipment equipment = new Equipment(Integer.parseInt(req.getParameter("equipmentId")));
//delete
dbEquipment.delete(equipment);
//remove in array list
for(int i = 0; i < seller.getListEquipment().size(); i++) {
if(seller.getListEquipment().get(i).getId() == equipment.getId()) {
seller.getListEquipment().remove(i);
}
}
//response
return "ok";
}
The seller attribute passed is from the HTTPSession : ((Seller) req.getSession().getAttribute(“user”))
This code update my object Seller fine offline but online the update doesn’t show up, it’s still the old object/ArrayList.
Try saving object back into session after you update it’s contents.