public String editGame() { GameManager gameManager = new GameManager(); // set id the same as the game that will be updated (in the case of saving, there's no id in the // session) if (session.get("id") != null) { game.setId(Integer.valueOf((String) session.get("id"))); session.remove("id"); } gameManager.saveOrUpdateGame(game); return "success"; }
public String execute() { GameManager gameManager = new GameManager(); game = gameManager.getGameById(id); CategoryManager categoryManager = new CategoryManager(); categoryList = categoryManager.getCategoryList(); // save id in session to access it later in editGame() session.put("id", id); return "success"; }