Actually, you should prohibit the "id" field both when adding and in updating. Otherwise, the attacker can change the value of the request parameter "id" of the update request and thereby update another record to the one shown by the form (if there is no ACL or other security at the domain level).
, "id" , null, , (, , , , ). , ( , ) , -. @SessionAttributes , ( ):
@SessionAttributes("thing")
public class ThingController {
public void setDisallowedFields(WebDataBinder binder) {
binder.setDisallowedFields("id", "someOtherUneditableField");
}
}
, . @SessionAttributes .