FileDocCategorySizeDatePackage
LoginAction.javaAPI DocExample1304Mon Aug 23 16:48:42 BST 2004com.oreilly.strutsckbk.ch10

LoginAction

public class LoginAction extends BaseAction

Fields Summary
Constructors Summary
Methods Summary
public org.apache.struts.action.ActionForwardexecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        
        String username = (String) PropertyUtils.getSimpleProperty(form, "username");
        String password = (String) PropertyUtils.getSimpleProperty(form, "password");
                
        SecurityService service = getSecurityService(request);
        service.authenticate( username, password);

        User user = new User();
        user.setUsername(username);
        request.getSession().setAttribute("user", user);
        
        return mapping.findForward("success");