• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sesion code

 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well im not at all getting this solved!!!
in my jsp page i have a button , onclicking the button the sesion should expire and the user should be automatically taken to the login page again . im giving the onClick javascript function here , pls advice..
onClick(){
window.alert("do u wanna go");
<% session.invalidate%>
window.open("...//index.html");
}
is this a valid one ???
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your application for an Intranet where "the boss" dictates the HW platform, the particular browser to use and with what capabilities enabled (like javaScript), or is your application intended to be used in the public WWW?
If the answer is the public WWW, you should not expect universal JavaScript support by your clients.
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for now we assume that javascript should be enabled!!
alicea just tell me if the code what i have written is correct or not???
 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it works
 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It won't work the way you want it to be. As the scriplet tag <% session.invalidate() %> would be processed on execution of jsp hence the session would be invalidate in any case.
The best way be to open / forward to another jsp (on clicking the button)which would invalidate the session for you.
Regards,
Vijay
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi vijay,
exactly what u said had happened (i being a dumb was scrotching my head why this was invalidating all my jsp pages)!!
can u just explain things in a bit more detail on how to forward it to a specific jsp page!!!
 
Peter Kristensson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change your code to this:

and the write the logout.jsp page:
<% session.invalidate %>
<jsp:forward page="...//index.html" />

Let me know if this works
/Peter
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi peter,
thanks for ur help , well it really works !!! but the thing is that i want to close the referring window (one which opens logout.jsp) do u have some idea how can i do this using javascript!!
hi vijay kashyap!
Thanks a lot for u also !
[This message has been edited by vivek sivakumar (edited August 20, 2001).]
 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivek shivakumar,
One of the solution being to open the logout.jsp in the same frame, in this case you donot have to care about closing the window.

If you want to avoid JavaScript then you can submit the page on clicking the button and based on your requirement fwd it logout.jsp page.
Hope this helps.
Regards,
Vijay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic