• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session handling problem

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I need help from you people and I am sure that you'll help me.
I am using jsp as front end,ms-access at the backend .I have done the validation part and the user is validated but when the user logs out from the main screen which is the jsp page ,he goes back to the login.html page ,over there the user shouldn't be able to go back once logged out.But over here it is showing me the previous page from where i logged out and also when the user logs in he can go back to the login.html page and without logging in he is directed to main page using forward.I have done the neccessary session handling but cant get the perfect result.Am i making any mistake or missing out something.
please help me .thanks in advance I am placing the code over here.


This is my main page. welcome.jsp


this is my logout.jsp



the loginpage is the login.html and the database connectivity is done by login1.jsp which forwards to welcome.jsp .
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use javascript.history.forward(1); in your jsp... when he comes out from the jsp..he can not go to that again

Hope this helps
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know how can one disable the back button or show error message once the user logged out ! But you can surely check a valid session on each JSP page and then allow user to perform operation or show results ! If in case the user logged out and go back on previous page using 'Back' button , he will not able to perform any operation , as you are checking its user id in session , which is no longer valid, user need to re-login !
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not properly understand.You mean to say that i have to place this code in jsp, javascript.history.forward(1); but in which jsp i have to place this code and how so that it is implemented for every user also if you are saying that to maintain user id session in each jsp page i have to use <%=session.getid()%> right.but how should i maintain it to not to go back.
please help me with suggestions.
thanks in advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



put this into your login page(which is contain username/password textbox) at header section...and try...
let me know,if any issue
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I placed that code in my login.html in the <head>-- </head> tag. But there is no changes to the scenario.And i did not understand forward(1),what is that 1 for.
please help me.I am still facing the same problem.
thanks in advance
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shiju nair:

forward(1),what is that 1 for.



hi, suppose you are putting that code in a.jsp then you went b.jsp(href link from a.jsp) now if you click back button of browser it will go a.jsp right?...that time browser will see that forward(1)..then it will go 1 step forward it mean you willbe in the same page (b.jsp)

i think you not using that code the particular page(which page you have to put)..

try and let me know


 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
you put below one also in your jsp to avoid the browser caching



Hope This Helps
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I am putting this code in my login.html which is my first page containing the username and password textbox,through which i will be directed to login1.jsp which is my database connectiviy and validation page.From there if the user is valid it is forwarded to welcome.jsp,now when i log out from welcome.jsp it takes me to login.html, but when i click the back in the standard bar it takes me back to welcome.jsp though i have not logged in that means my session is still running.I tried to place this code as i stated above but no difference it is giving me the same result.
please solve this problem for me.
thanks in advance.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Let me try out the second one .
thanks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shiju nair:
hi,
I am putting this code in my login.html which is my first page containing the username and password textbox,through which i will be directed to login1.jsp which is my database connectiviy and validation page.From there if the user is valid it is forwarded to welcome.jsp,now when i log out from welcome.jsp it takes me to login.html, but when i click the back in the standard bar it takes me back to welcome.jsp though i have not logged in that means my session is still running.I tried to place this code as i stated above but no difference it is giving me the same result.
please solve this problem for me.
thanks in advance.



Then you put in welcome.jsp (you have to put that javascript in welcome.jsp)...i think your not geeting me
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Now the scene is that when i added your code in jsp,the back button in the welcome page is not functioning that means, the person has to logout that is nice.but once the user logs out and comes to the login.html from there he is able to press the back button and can go back to previous welcome page without logging in.
should i do one thing i should make that html page into jsp page and add the same code over there also. will that make any difference or else any other solution.
please suggest .thanks in advance.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have added this code in welcome.jsp as you suggested but it does not make any difference it is the same as i mentioned just now.
one more thing you want me to place that javascript code also in the login.html .
please suggest.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
sorry i was a bit mistaken in my previous statement .i will add the javascript in the welcome.jsp .hope it works.
thanks
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
the code what you told really worked.
thanks a lot.
one more thing has happened now due to the changes that i made now when i am logging in as wrong user and password it is not giving me the invalid page else it is showing me a blank page where in i cant even go back.
please suggest.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
thanks a lot, now all the things are working fine as i want.I am going ahead with my project and if i find any problem,hope you are always there to help .
thanks again.
take care
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are welcome
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic