| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 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 |
|
|
| 15 |
|
|
| 16 |
0 |
public class UpdateUserAction extends Action { |
| 17 |
|
public ActionForward execute(ActionMapping mapping, ActionForm objForm, |
| 18 |
|
HttpServletRequest request, HttpServletResponse res) { |
| 19 |
|
try { |
| 20 |
0 |
ServiceLocator.getServiceLocator().getUserService().updateUser(((UserForm)objForm) |
| 21 |
|
.toUserView()); |
| 22 |
0 |
return mapping.findForward("success"); |
| 23 |
|
} |
| 24 |
|
catch (UnknownUserException e) { |
| 25 |
0 |
ActionErrors errors = new ActionErrors(); |
| 26 |
0 |
errors.add("id", new ActionError("user.edit.unknown.user")); |
| 27 |
0 |
saveErrors(request, errors); |
| 28 |
0 |
return mapping.findForward("failure"); |
| 29 |
|
} |
| 30 |
|
catch (InvalidUserException e) { |
| 31 |
0 |
saveErrors(request, e.getErrors()); |
| 32 |
0 |
return mapping.findForward("failure"); |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
} |