• Post Reply Bookmark Topic Watch Topic
  • New Topic

session problem  RSS feed

 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am used
<meta http-equiv="refresh"content="<%= session.getMaxInactiveInterval()%>;url=logout">
and i set web.xml

<session-config>
<session-timeout>1</session-timeout> </session-config>

its working fine.1 min after the page automatically goto (logout.java)fine

but i need time=50 sec that time i want automatically upadtaed one database before session killed.is it possible

help me
 
Abhishek Asthana
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i need time=50 sec that time i want automatically upadtaed one database before session killed.is it possible


Can you write this in proper human-understandable english? I could not make anything out of it!
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using a session listener to update the database?
 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Abhishek Asthana:


Can you write this in proper human-understandable english? I could not make anything out of it!




How to get a session value even after session is time out.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ayyappan Bas:




How to get a session value even after session is time out.


What
Do you mean session attributes ? If yes then its not possible. And you haven't thought of my above post ?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ayyappan Bas:




How to get a session value even after session is time out.


Not Possible ....
---------------------------------------------------------------------
if you want a page have to expire after 50 sec then you give
<meta http-equiv="refresh" content="50;url=logout.jsp" />
---------------------------------------------------------
 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have set session timeout 60 sec but when session out reach 50 sec .my query should update in database for example.

if( session.getMaxInactiveInterval()==50)
String str="update session set status='YES'where name='"+name+"'";
st1.executeUpdate(str);

Is it possible ???
 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit Ghorpade:


What
Do you mean session attributes ? If yes then its not possible. And you haven't thought of my above post ?


i have set session timeout 60 sec but when session out reach 50 sec .my query should update in database for example.

if( session.getMaxInactiveInterval()==50)
String str="update tablename set status='YES'where name='"+name+"'";
st1.executeUpdate(str);

Is it possible ???
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ayyappan Bas:


i have set session timeout 60 sec but when session out reach 50 sec .my query should update in database for example.

if( session.getMaxInactiveInterval()==50)
String str="update tablename set status='YES'where name='"+name+"'";
st1.executeUpdate(str);

Is it possible ???


i guess you need to find the session age

current age= session.getLastAccessedTime - session.getCreationTime

if current age == 50 then update the DB

Hope This Helps
 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharaman venkatasamy:


i guess you need to find the session age

current age= session.getLastAccessedTime - session.getCreationTime

if current age == 50 then update the DB

Hope This Helps


Thanks
yes correct.
age=(session.getLastAccessedTime()-(session.getCreationTime()));its working well
but i show age value =55953; its more value.how to convert 50 sec.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ayyappan Bas:
how to convert 50 sec


------------------------
1 millisecond =0.001 sec

so, 1 sec=1000 millisec
--------------------------

so ayyappan , you need to find out
 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharaman venkatasamy:


------------------------
1 millisecond =0.001 sec

so, 1 sec=1000 millisec
--------------------------

so ayyappan , you need to find out ;)


Thanks sir
long a=(session.getLastAccessedTime());
long age;
age=(session.getLastAccessedTime()-(session.getCreationTime()));
if(age==50000)
{

String str="update session set status='YES'where name='"+name+"'";
st1.executeUpdate(str);

}

if condition did not working.help me sir
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth would you be setting the session timeout to 60 seconds? Perhaps it's time to back up a step and explain what it is you are really trying to accomplish by doing so.

You're not trying to use the session timeout as a timer, are you?
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear , I can't stop my laugh for the day as you mentioned session for 60 secs .

Seetha , excellent answer from you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!