• Post Reply Bookmark Topic Watch Topic
  • New Topic

showing session id in form dynamically  RSS feed

 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a text field and when I click a button I want to show current session id. I code following in the onclick event:

myform.sess.value= <%= session.getId() %>;

When I run this it gives me error sometime invalid object and sometime undefined 'E289938890389013890'.


That is really the session id. What am i doing wrong? All I am trying to see what happens to session id when session timesout.
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that when a session times out, it becomes null.

As far as printing out the session ID via a button click, I guess that could be doable with some Javascript.. however, as far as a straight JSP call like you think you can do with the <%= session.getID()%>, that is set when the page is first loaded, not dynamic to each time the button is clicked. That's how JSP works.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're writing a Javascript string.
Put quotes around it.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!