jp.terasoluna.fw.web.struts.actions
Class ClearSessionAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by jp.terasoluna.fw.web.struts.actions.ActionEx
          extended by jp.terasoluna.fw.web.struts.actions.ClearSessionAction

public class ClearSessionAction
extends ActionEx

Deletes the specified property from the session.

From the list of keys specified in definition file, fetch the key which needs to be deleted from the session and delete it from the session.

Since transition destination is the address specified in "parameter" attribute of <action> element. "parameter" attribute is necessary. The configuration example of Bean definition file and struts-config.xml is shown below.

Configuration example of ClearSessionAction in Bean definition file

 <bean name="/clearSessionAction" scope="singleton"
   class="jp.terasoluna.fw.web.struts.actions.ClearSessionAction">
   <property name="clearSessionKeys">
   <list>
     <value>userAddress</value>
     <value>userPhoneNo</value>
     <value>sampleSession</value>
   </list>
   </property>
 </bean>
 

Configuration example of struts-config.xml

 <action path="/clearSessionAction"
   name="_sampleForm"
   scope="session"
   parameter="/sessionCleared.do">
 </action>
 
In the above example, when action path name "/clearSessionAction" is executed, clearSessionKeys property becomes the target key for deletion. As a result, the session information which is referred with 3 session keys namely, userAddress, userPhoneNo and sampleSession, is deleted.
Refer to LogoffAction to cancel the current session.

See Also:
LogoffAction

Field Summary
private  java.util.List clearSessionKeys
          List of keys to be deleted from the session.
private static java.lang.String FORWARD_ERRORPAGE_ERROR
           Error page (404) Error code indicating the transition failure.
private static org.apache.commons.logging.Log log
          Log class.
 
Fields inherited from class jp.terasoluna.fw.web.struts.actions.ActionEx
FORWARD_TXTOKEN_ERROR
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
ClearSessionAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward doExecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Clears the session and forwards to the next screen.
 void setClearSessionKeys(java.util.List clearSessionKeys)
          Sets the list of keys to be deleted from the session.
 
Methods inherited from class jp.terasoluna.fw.web.struts.actions.ActionEx
addErrors, addMessages, execute, isSaveToken, isTokenCheck, processTokenCheck, setSaveToken, setTokenCheck
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Log class.


FORWARD_ERRORPAGE_ERROR

private static final java.lang.String FORWARD_ERRORPAGE_ERROR
Error page(404) Error code indicating the transition failure.

See Also:
Constant Field Values

clearSessionKeys

private java.util.List clearSessionKeys
List of keys to be deleted from the session.

Constructor Detail

ClearSessionAction

public ClearSessionAction()
Method Detail

setClearSessionKeys

public void setClearSessionKeys(java.util.List clearSessionKeys)
Sets the list of keys to be deleted from the session.

Parameters:
clearSessionKeys - List of keys to be deleted from the session

doExecute

public org.apache.struts.action.ActionForward doExecute(org.apache.struts.action.ActionMapping mapping,
                                                        org.apache.struts.action.ActionForm form,
                                                        javax.servlet.http.HttpServletRequest request,
                                                        javax.servlet.http.HttpServletResponse response)
Clears the session and forwards to the next screen.

When there is not even a single key to be deleted, returns the information about the transition destination and terminates the process.

Specified by:
doExecute in class ActionEx
Parameters:
mapping - Action mapping
form - Action form
request - HTTPRequest
response - HTTPResponse
Returns:
Transition information