com.pow2.struts.actions
Class LoginAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bycom.pow2.struts.action.BaseAction
          extended bycom.pow2.struts.action.DispatcherAction
              extended bycom.pow2.struts.actions.LoginAction

public class LoginAction
extends DispatcherAction

Login Action class.
Try to retrieve an authenticated user from the database, then set that user object into the the Session context and redirect to the login resource.
The default forward name for a succesfull login is "success"; you can specify another forward name using:

The default failure forward name is specified by BaseAction.FWD_FAILURE; you can specify a different failure forward name using the failure request parameter.

Author:
Luca Fossato

Field Summary
 
Fields inherited from class com.pow2.struts.action.BaseAction
cat, FWD_CANCEL, FWD_FAILURE, FWD_INVALID_SESSION, FWD_LOGIN
 
Fields inherited from class org.apache.struts.action.Action
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Constructor Summary
LoginAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, HttpServletRequest request, HttpServletResponse response)
          Retrieve the User object from the database using the submitted login and passwd ActionForm properties.
 
Methods inherited from class com.pow2.struts.action.BaseAction
failureForward, getForward, invalidSessionForward, isFailureForward, loginForward, loginForward, validateSession
 
Methods inherited from class org.apache.struts.action.Action
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoginAction

public LoginAction()
Method Detail

execute

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
                                                      org.apache.struts.action.ActionForm form,
                                                      HttpServletRequest request,
                                                      HttpServletResponse response)
                                               throws IOException,
                                                      ServletException
Retrieve the User object from the database using the submitted login and passwd ActionForm properties.
If login is successful, save the retrieved User object reference into the Session, and redirect to the specified resource.
Else remove any (previous) user reference from the Session context and redirect to the failureForward resource.

Note:
this action must be used with the com.pow2.struts.forms.LoginForm class !!

Overrides:
execute in class DispatcherAction
Parameters:
mapping - Description of the Parameter
form - Description of the Parameter
request - Description of the Parameter
response - Description of the Parameter
Returns:
Description of the Return Value
Throws:
ServletException
IOException


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.