View Javadoc
1 /* 2 * Demosys. 3 * 4 * Terms of license - http://opensource.org/licenses/apachepl.php 5 */ 6 package org.demosys.web.user.action; 7 import java.lang.reflect.InvocationTargetException; 8 import javax.servlet.http.HttpServletRequest; 9 import javax.servlet.http.HttpServletResponse; 10 import org.apache.commons.beanutils.BeanUtils; 11 import org.apache.commons.lang.StringUtils; 12 import org.apache.struts.action.*; 13 import org.demosys.web.ServiceLocator; 14 import org.demosys.web.user.InvalidUserException; 15 import org.demosys.web.user.UnknownUserException; 16 import org.demosys.web.user.UserService; 17 import org.demosys.web.user.UserView; 18 /*** 19 * Select a specific user to Edit the record. 20 */ 21 public class SelectUserAction extends Action { 22 public ActionForward execute(ActionMapping mapping, ActionForm objForm, 23 HttpServletRequest request, HttpServletResponse res) 24 throws IllegalAccessException, InvocationTargetException { 25 // Get user id from request parameter 26 String id = request.getParameter("id"); 27 28 try { 29 UserService userService = ServiceLocator.getServiceLocator().getUserService(); 30 UserView user = userService.getUser(id); 31 BeanUtils.copyProperties(objForm, user); 32 return mapping.findForward("success"); 33 } 34 catch (UnknownUserException e) { 35 ActionErrors errors = new ActionErrors(); 36 errors.add("id", new ActionError("user.edit.unknown.user")); 37 saveErrors(request, errors); 38 return mapping.findForward("failure"); 39 } 40 } 41 }

This page was automatically generated by Maven