question: public ActionForward validateUser ( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws Exception { Properties ctx = TmkJSPEnv . getCtx ( request ) ; DefaultForm df = ( DefaultForm ) form ; LoginBean bean = ( LoginBean ) df . getBean ( ) ; HttpSession session = request . getSession ( ) ; WebUserInfo info = null ; WebUser wu = null ; try { wu = bd . checkLoginPassword ( ctx , bean ) ; info = bd . login ( ctx , wu ) ; MSession cSession = MSession . get ( ctx , request . getRemoteAddr ( ) , request . getRemoteHost ( ) , session . getId ( ) ) ; if ( cSession != null ) cSession . setWebStoreSession ( true ) ; session . setAttribute ( WebUserInfo . NAME , info ) ; ArrayList myRoles = RoleManager . getMyRoles ( ctx ) ; if ( myRoles . size ( ) == 1 ) { KeyNamePair pair = ( KeyNamePair ) myRoles . get ( 0 ) ; Env . setContext ( ctx , "#AD_Role_ID" , pair . getKey ( ) ) ; SessionStorage . putMenus ( ctx , request ) ; SessionStorage . putOrg ( ctx , request ) ; return mapping . findForward ( LOGIN_SUCCESS ) ; } } catch ( UserNotFoundException unfe ) { postGlobalError ( "login.passwordError" , request ) ; return ( mapping . getInputForward ( ) ) ; } catch ( NotLoggedInException e ) { postGlobalError ( "login.passwordError" , request ) ; return ( mapping . getInputForward ( ) ) ; } catch ( InvalidRoleException ire ) { postGlobalError ( "error.role.invalid" , request ) ; return ( mapping . getInputForward ( ) ) ; } catch ( UserInactiveException unae ) { postGlobalError ( "login.userInactive" , request ) ; return ( mapping . getInputForward ( ) ) ; } return mapping . findForward ( INIT_CHOOSE_ROLE ) ; }
target:  We check whether the name & password supplied is valid Result: If valid we forward to choose role else we forward to login page witn appropriate login error 