Why don't you clean up your code first and make sure that you only have the
session.invalidate() in there? This will tell you if it works or not. If it
does then you can just add back the other bits and pieces of codes that you
have there (one by one) and see which one is causing your problem.
"Villegas, Courtney" <[EMAIL PROTECTED]> on 05/13/2002 03:53:07 PM
Please respond to "Struts Users Mailing List"
<[EMAIL PROTECTED]>
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
Subject: LogoutAction
I am having troubles with the logout action that I have written. It
directs
me to the correct page, but does not actually log the user out and close
the
session. I have attached my action and the info from my struts-config
file.
I am calling session.invalidate() incorrectly?
Thanks
Courtney
<!--************************************* Logoff Action
*************************************-->
<action path="/logoff"
type="org.trimet.security.actions.LogoffAction"
scope="request">
<forward name="success" path="/jsp/ctest.jsp"/>
</action>
package org.trimet.security.actions;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;
import java.util.Vector;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
import org.apache.commons.beanutils.PropertyUtils;
import org.trimet.security.states.Constants;
import org.trimet.security.states.User;
/**
* Implementation of <strong>Action</strong> that logs user out of current
session
*
* @author Courtney S. Villegas
* @version $Revision: 1.0 $ $Date: 2002/05/13 03:03:00 $
*/
public final class LogoffAction extends Action {
// --------------------------------------------------------- Public
Methods
/**
* Process the specified HTTP request, and create the corresponding
HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and
how
* control should be forwarded, or <code>null</code> if the response
has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param actionForm The optional ActionForm bean for this request (if
any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Extract attributes we will need
Locale locale = getLocale(request);
MessageResources messages = getResources();
HttpSession session = request.getSession();
String action = request.getParameter("Load");
if (action == null)
action = "Load";
if (servlet.getDebug() >= 1)
servlet.log("LogoffAction: Processing " + action +
" action");
// Is there a currently logged on user?
User user = (User) session.getAttribute(Constants.USER_KEY);
if (user == null) {
if (servlet.getDebug() >= 1)
servlet.log(" User is not logged on in session "
+ session.getId());
return (servlet.findForward("logon"));
}
// Forward control to the GISAppDev page
if (servlet.getDebug() >= 1)
servlet.log(" Forwarding to 'GIS App Dev' page");
user=null;
session.invalidate();
return (mapping.findForward("success"));
}
}
--
To unsubscribe, e-mail: <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>
**********************************************************************
Please Note:
The information in this E-mail message, and any files transmitted
with it, is confidential and may be legally privileged. It is
intended only for the use of the individual(s) named above. If you
are the intended recipient, be aware that your use of any confidential
or personal information may be restricted by state and federal
privacy laws. If you, the reader of this message, are not the
intended recipient, you are hereby notified that you should not
further disseminate, distribute, or forward this E-mail message.
If you have received this E-mail in error, please notify the sender
and delete the material from any computer. Thank you.
**********************************************************************
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>