Did you tried the code given in previous post. Here two samples are given.
You try it.
This throws nullpointer exception
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%session.invalidate();%>
<html:form action="/LoginAction">
</html:form>
But this one wont throw any exceptions.
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%session.invalidate();%>
I am working on porting a project to Struts. This error happened when I
copied contents of the old index.jsp to new Struts index.jsp. The error is
due to html tag.
rgds
Antony Paul.
----- Original Message -----
From: "Martin Gainty" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, December 11, 2003 5:55 AM
Subject: Re: session.invalidate() throws exception.
> so you call invalidate()
> Causes this representation of the session to be invalidated and removed
from
> its context.
> then you call get on the invalidated session..
> Reminds me of the construction worker who said no matter how many times I
> cut this it's still too short..
> Think about it..
> -Martin
> ----- Original Message -----
> From: "Antony Paul" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, December 10, 2003 7:35 AM
> Subject: Re: session.invalidate() throws exception.
>
>
> > A sample code is given. Using Tomcat 4.1.27. Struts 1.1 I think
downloaded
> > on june 03.
> >
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
> > <%
> > session.invalidate();
> > %>
> > <html:form action="/LoginAction" onsubmit="return
> validateLoginForm(this)">
> > </html:form>
> >
> > The error statck is given in first message.
> >
> > rgds
> > Antony Paul.
> >
> >
> > ----- Original Message -----
> > From: "Gurpreet Dhanoa" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Wednesday, December 10, 2003 5:36 PM
> > Subject: Re: session.invalidate() throws exception.
> >
> >
> > > hi Antony
> > >
> > > Can you please briefly explaing the scope and the error
> > >
> > > Thanks
> > > Gary
> > > ----- Original Message -----
> > > From: "Antony Paul" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, December 10, 2003 5:30 PM
> > > Subject: Re: session.invalidate() throws exception.
> > >
> > >
> > > > Then index.jsp is to be mapped to an action in web.xml. My situation
> is
> > > user
> > > > goes to another site then returns to home page of our application.
> > > >
> > > > rgds
> > > > Antony Paul.
> > > > ----- Original Message -----
> > > > From: "Raman Garg" <[EMAIL PROTECTED]>
> > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > > Sent: Wednesday, December 10, 2003 5:05 PM
> > > > Subject: Re: session.invalidate() throws exception.
> > > >
> > > >
> > > > > 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]
> > > > >
> > > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > 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]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]