• 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

use of hidden fields

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the benifit of HIDDEN FORM FIELDS during SESSION TRACKING.
like it is written that the client send some information hidden and used by the server,what exactly the use is..
thank you
gaurav
 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use it to send values hidden from the user (i.e. no input box displayed). I use this for one application to send operation names from the client to a server which the Servlet will read and execute, and read other parameters if necessary. I wouldn't want this displayed in an input box, so making it hidden is useful.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also keep in mind that if you are using hidden fields for session tracking you should take care not to hold any sensitive data in hidden fields since we can view the values held by the hidden fields by actually viewing the source of the html page.
- John
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hidden form fields are not for session tracking.

We have two mechanism for session tracking, they are cookies and URL rewriting, the latest for the people that doesn't have cookies enabled in their browsers, I could only understand sending a session id in a hidden field when you have your own session tracker and are not using the one that is already with your server container (HttpSession and all), but why re-invent the wheel?

Hidden fields are for passing information between pages, sometimes I use a <input type="hidden" name="action" value="XXX"> and I clearly don't want that information displayed to the user
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you ever seen the movie Finding Nemo? When using hidden form fields to store session (or conversational) state, it's kind of like your server is Dory (the fish with no long-term memory). Everytime you talk to the server again, you have to re-introduce yourself and remind it of what you've spoken with it about in the past, by passing it all of that information in the hidden form fields. This does take some of the memory burden off of the server. However, it can be tough to make sure you're actually writing all of the necessary hidden form fields (and their appropriate values) back to the client for use in the next request.
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's probably worth mentioning that hidden form fields are almost worthless if they're not written out by the Servlet/JSP itself (I'm assuming you're using Servlets here.) Hardcoding a hidden right into an HTML page doesn't typically serve any useful purpose, unless that field is being manipulated some way by JavaScript.
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to my experiences, that hidden fields are used to store values that is not displayed to users (such as using text field).
Especially for storing the id of record is being displayed and the mode of process (such as ADD or UPDATE).

Correct me if I am wrong..

thanks
daniel
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a quote from my Internet Architecture page. The page very briefly discusses the pros & cons of each. See if it gives you some useful ideas ...

"Web applications often have to hold some information about the user for the time the user is browsing the site, say a shopping cart with several items in it. Designers have many choices about where to put such data. Here are a few:

[ February 10, 2005: Message edited by: Stan James ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic