Re: session.invalidate() throws exception.
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
RE: session.invalidate() throws exception.
This not throwing nullpointer exception %@ taglib uri=/WEB-INF/struts-html.tld prefix=html% html:form action=/LoginAction /html:form %session.invalidate();% ...kadir... -Original Message- From: Antony Paul To: Struts Users Mailing List Sent: 12/11/2003 3:55 PM Subject: Re: session.invalidate() throws exception. 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(StandardS essi 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
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]
RE: session.invalidate() throws exception.
one should either *catch* Exception OR use errorPage attribute of [EMAIL PROTECTED] ... directive to handle error HTH Navjot Singh -Original Message- From: Antony Paul [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 5:08 PM To: struts 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(StandardSe ssion.jav a:954) at org.apache.catalina.session.StandardSessionFacade.getAttribute(Stan dardSessi 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]
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]
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]
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]
RE: session.invalidate() throws exception.
It seems that your session is getting killed when you navigate to another site and subsequently when you try to invalidate the session it is giving an error since session is already killed. May be you should check for the existence of session and then if the session exists then only try to invalidate the session. Milind -Original Message- From: Antony Paul [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 5:31 PM To: Struts Users Mailing List 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]
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]
RE: session.invalidate() throws exception.
Usually, it is a bad idea to do these thing inside a JSP(or View). Front Controller is where you want to do all these tuff. Sure, you can query the session object before you invalidate its or just try/catch IlligalStateException and ignore it. Danny Trieu Internet Business Group Downey Savings and Loan Association, F.A. [EMAIL PROTECTED] (949) 509-4564 The beginning of knowledge is the discovery of something we do not understand. - Frank Herbert (1920-1986) The essence of knowledge is, having it, to apply it; not having it, to confess your ignorance. - Confucius (551-479 BC) -Original Message- From: Antony Paul [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 3:38 AM To: struts 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] This message and any attachments are for the intended recipient(s) only and may contain privileged, confidential and/or proprietary information about Downey Savings or its customers, which Downey Savings does not intend to disclose to the public. If you received this message by mistake, please notify the sender by reply e-mail and delete the message and attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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