意見 :
#{form @UserController.editUser()}
<input type="hidden" value=${user?.id} name="user.id">
#{input key:'user.instructions', label: 'Instructions', value: user?.instructions /}
//// Assume the value of the instructions is "Old" (currently in the database) and the user changes it in the view to "New" using the input box
***(input is a tag I created.)***
<div class="form-actions">
<button id="save" type="submit" class="btn btn-primary" name="event" value="update">
<i class="icon-save"></i> Save
</button>
</div>
#{/form}
コントローラー:
public static void editUser(User user) {
User old = User.findById(user.id);
/// Right here I need the old record before i edit it. How do i get the old value? That is, i need record with user.instructions = "Old". I always get the record where user.instructions = "New" even though it is not saved in the database
user.save();
}