Hello Antony

Here is a sample of code, hopes this solves your problem...

    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws
Exception {

        // Extract attributes and/or parameters we will need
        Locale locale = getLocale(request);
        MessageResources messages = getResources(request);
        HttpSession session = request.getSession();

        // Get already logged user info from session scope // **** We have a
Customer Bean in session
        Customer customer = (Customer)session.getAttribute(USER_KEY);

        // If customer has not logged in, return control to User Login view
with
        // that reason.
        if (customer == null) {
            return new ActionForward("/Login.do?reason=" +
LOGIN_REASON_NOT_LOGGED_IN, true);
        }
}


-- Raman
----- Original Message ----- 
From: "Antony Paul" <[EMAIL PROTECTED]>
To: "struts" <[EMAIL PROTECTED]>
Sent: Wednesday, December 10, 2003 5:08 PM
Subject: session.invalidate() throws exception.


> Hi,
>     Calling session.invalidate() in index.jsp throws this exception
> java.lang.IllegalStateException: getAttribute: Session already invalidated
> at
>
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.jav
> a:954)
> at
>
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessi
> onFacade.java:171)
> at org.apache.struts.taglib.html.FormTag.renderToken(FormTag.java:641)
> at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:513)
> at org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
>
> How to change this behavior. Better if possible to do some house keeping
> before invalidating session like if a valid session and data is present in

> session then go to a certain page.
>
> rgds
> Antony Paul.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to