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.UnknownUserException;
12 import org.demosys.web.user.UserService;
13 /***
14 * Delete a user.
15 */
16 public class DeleteUserAction extends Action {
17 public ActionForward execute(ActionMapping mapping, ActionForm objForm,
18 HttpServletRequest request, HttpServletResponse res) {
19 // Get user id from request parameter
20 String id = request.getParameter("id");
21
22 try {
23 UserService userService = ServiceLocator.getServiceLocator().getUserService();
24 userService.deleteUser(id);
25 return mapping.findForward("success");
26 }
27 catch (UnknownUserException e) {
28 ActionErrors errors = new ActionErrors();
29 errors.add("id", new ActionError("user.delete.unknown.user"));
30 saveErrors(request, errors);
31 return mapping.findForward("failure");
32 }
33 }
34 }
This page was automatically generated by Maven