Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Hidden Form Fields 
 

Hidden form field is used to maintain the session. It is one of the way to maintain the session.

 

Hidden Form Fields

                          

Hidden form field is used to maintain the session. It is one of the way to maintain the session. In hidden form fields the html entry will be like this : <input type ="hidden" name = "name" value="">. This means that when you submit the form, the specified name and value will be get included in get or post method. In this session ID information would be embedded within the form as a hidden field and submitted with the http post command. 

In this program of hidden form fields firstly we are making a jsp form or html form in which we are using the post method and where the request will be submitted or controlled, it is done by a controller SettingHiddenField.jsp, it is the jsp where the business will be applied.  

The code of the program is given below:

<HTML>
    <HEAD>
        <TITLE>Submitting Hidden Fields</TITLE>
    </HEAD>
 
    <BODY>
        <H1>How to use a Hidden fields </H1>
        <FORM ACTION="SettingHiddenField.jsp" METHOD="post">
			Enter your name : <input type ="text" name = "name" value = ""> 
            <input type="hidden" name="hidden" value="You are most Welcome!">
            <input type="submit" value="submit">
        </FORM>
    </BODY>
</HTML>

 

<HTML>
  <HEAD>
    <TITLE>Reading Hidden Controls</TITLE>
  </HEAD>
    <BODY>
        <H1>Reading Hidden Controls</H1>
        <% 
			String string = request.getParameter("name");
            String text = "";
            if(request.getParameter("text1") != null) {
                out.println(string + "The hidden 
text is:" +request.getParameter("text1")); text = request.getParameter("text1"); } %> <FORM ACTION="GettinHiddenField.jsp" METHOD="post"> <input type="text" name="text1"> <input type="hidden" name="hidden" value="<%= text%>"> <input type="submit" value="Set Hidden Text"> </FORM> </BODY> </HTML>

 

<HTML>
<HEAD>
<TITLE>The Hiddern Fields</TITLE>
</HEAD>

<BODY>
<% out.println(request.getParameter("name"));%>
<H1>We can read hidden fields</H1>
The hidden text is: 
<% out.println(request.getParameter("hidden")); %>
</BODY>
</HTML>

The output of the program is given below:

After adding the name the output will be.

Download this example.


 

                          

» View all related tutorials
Related Tags: java c web com ide session data application io module copy help sessions sed output vi value using this id

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

3 comments so far (
post your own) View All Comments Latest 10 Comments:

Say a page uses the hidden field to store your session. If you want to read that hidden field in java how is this done?

Posted by Me on Saturday, 05.31.08 @ 23:57pm | #61606

The site is containing a lot of information and it is excellent !!

Posted by shri on Wednesday, 03.5.08 @ 11:58am | #51403

I m newbie and tring to learn hidden form fields session management...but its seems this example is missing with one file SettingHiddenField.jsp can u pls update this page and put that file. Thank you.

Posted by sunny on Friday, 08.24.07 @ 06:34am | #24015

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.