Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Tracking Mechanisms?

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

How does the hidden field becomes one way to track sessions??
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an old technique to keep the value of a variable between request.
Let's think of an example. You enter your name in a text field, and then press the submit button.
One way ot store the value is to put it in a hidden input field, in the next page, inside a form.
<input type="hidden" name="username" value="Jothi"/>
When you submit again to an other page, your name is sent back again. Your name will be available as long as it is stored in a hidden field.
You can imagine that it is a pain to maintain.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Satou...it really is a pain to maintain. Thanks for the help!
 
Vyas
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can check for the session thru the request object rather than hidden variable.

Regardless, I could not understand the pain
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vyas,
welcome to the ranch. You may not be aware of the Javaranch Naming Policy yet. Could you please read it, and change your name accordingly ? Thank you.
http://www.javaranch.com/name.jsp


Regardless, I could not understand the pain

With hidden variables, you would have to keep track of your variables through all pages, which is challenging when you have a lot of input elements.
This was mainly used when session were not available in the old days
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic