我有这个代码:

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";


}

传递的卖方属性来自HTTPSession:((卖方)req.getSession()。getAttribute(“ user”))

这段代码离线更新了我的对象Seller,但在网上没有显示更新,它仍然是旧的对象/ ArrayList。

最佳答案

更新对象的内容后,尝试将其保存回会话中。

07-24 16:06