1 /*
2 * Demosys.
3 *
4 * Terms of license - http://opensource.org/licenses/apachepl.php
5 */
6 package org.demosys.web.user.action;
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse;
9 import org.apache.struts.action.*;
10 import org.demosys.web.ServiceLocator;
11 import org.demosys.web.user.InvalidUserException;
12 import org.demosys.web.user.UnknownUserException;
13 /***
14 * Update User.
15 */
16 public class UpdateUserAction extends Action {
17 public ActionForward execute(ActionMapping mapping, ActionForm objForm,
18 HttpServletRequest request, HttpServletResponse res) {
19 try {
20 ServiceLocator.getServiceLocator().getUserService().updateUser(((UserForm)objForm)
21 .toUserView());
22 return mapping.findForward("success");
23 }
24 catch (UnknownUserException e) {
25 ActionErrors errors = new ActionErrors();
26 errors.add("id", new ActionError("user.edit.unknown.user"));
27 saveErrors(request, errors);
28 return mapping.findForward("failure");
29 }
30 catch (InvalidUserException e) {
31 saveErrors(request, e.getErrors());
32 return mapping.findForward("failure");
33 }
34 }
35 }
This page was automatically generated by Maven