File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Session Expired Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Expired" Watch "Session Expired" New topic
Author

Session Expired

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi,
Iam getting "Session Expired" Message & a session expired exception message (com.dcom.servelts.SessionexpiredException : Session Expired at com.dcom.servelts.handle.getSessionData())
on the screen , when my session is expired.

I need to display only "Session Expired" message on the screen.(not both)

Please help me.

Thanks
s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113
You might want to catch com.dcom.servelts.SessionexpiredException exception and display the message you wanted to display onto the browser.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You can configure a seperate page for this exception in your web.xml.
See <error-page>, <exception-type> elements.
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Thanks for reply.My page doesn't contain <error-page>, <exception-type> elements.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Bhaskar Gara:
Thanks for reply.My page doesn't contain <error-page>, <exception-type> elements.


Please read my previous post carefully, you will know that I was not talking about your JSP page, I was refering to web.xml (Deployment Descriptor) elements instead.
Thanks.
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
My web.xml file doen't contain those elements.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

My web.xml file doen't contain those elements.


Then you got to configure them.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
My code ........
if (session == null)
throw new SessionExpiredException();


In my web.xml file i declared :

<error-page>
<error-code>SessionExpiredException</error-code>
<exception-type>java.lang.Exception</exception-type>
<location>/sevelts/framework/SessionExpiredException</location>
</error-page>


But still i am getting both..( SessionExpired message & Exception)

why it is keep saying where the session is expired ..

com.dcom.servlets.framework.SessionExpiredException: Session Expired at com.wbiForm.performService(JoinForm.java:136) at com.dcom.servlets.framework.ServletFramework.Service(ServletFramework.java:1051) at com.dcom.servlets.framework.ServletFramework.doPost

[ December 30, 2005: Message edited by: Bhaskar Gara ]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Try something like below.

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Thanks for your reply.I changed my code like...
<error-page>
<exception-type>com.dcom.servlets.framework.SessionExpiredException</exception-type>
<location>/JoinForm</location>
</error-page>
JoinForm is java servlet
Still iam getting same exception
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
Why do you have the location as joinForm? The location element should contain the page (jsp, html) you want displayed to the user when the error occurs. You can get more info if you search the forum or the web at large.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Expired
 
Similar Threads
How to know a client is trying to use an expired session?
Session time out error
HttpSession
Session timeout
session timeout - how does it work?