Database Reference
In-Depth Information
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" id="updateUser" class="btn btn-default">Update User</button>
</div>
</div>
</form>
User Action
The UserAction controller contains an edit method with the path /user/edit , which takes a JSON object as an
argument. You should note that the User object is converted from a JSON string and returns a User object as JSON . The
response could be used to update the form elements, but because the values are already set within the form there is
no need to update the values. In this case, the application uses the JSON response to let the user know if the update
succeeded or not via a standard JavaScript alert message (Listing 12-23).
Listing 12-23. The edit Method in the UserAction Class
@Action(value = "user/edit", interceptorRefs = {
@InterceptorRef(value = "cookie", params = { "cookiesName", "graphstoryUserAuthKey" }),
@InterceptorRef(value = "json", params = { "noCache", "true", "excludeNullProperties",
"true" }) },
results = {
@Result(name = "success", type = "json", params = { "noCache", "true" })
})
public String edit() {
try {
if (graphStory.getUser() != null) {
graphStory.setUser(graphStoryDAO.getUserDAO()
.update(
cookiesMap.get(GraphStoryConstants.graphstoryUserAuthKey),
graphStory.getUser())
);
}
}
catch (Exception e) {
log.error(e);
}
return SUCCESS;
}
 
Search WWH ::




Custom Search