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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JSP WITH MULTIPLE FORMS 
 

In this example, you will learn how to make multiple forms in single jsp page. Most of the times people need to use multiple forms on a single page. For example on one web page you may add forms for login, search and send link to friends.

 

JSP WITH MULTIPLE FORMS

                         

In  this example, you will learn how to make multiple forms in single jsp page. Most of the times people need to use multiple forms on a single page. For example on one web page you may add forms for login, search and send link to friends.

Program Description:

These type of programs are almost used for performing specific operations on the the specific form data. This page submit only one form with it's data at a time.

Code Description:

We used html code and jsp tag to complete these Forms(Form1, Form2, Form3) that we have made on a single page. Here you will see how this program works. Suppose if you clicked on the button (labeled by "Form 1"), you will see the data of Form1. If you clicked on button (labeled by "Form 2") that is a field of second form in the document, you will see the data of  Form2. But there are three forms in the page and each form has a submit button with different label like "Form 1", "Form 2" and last one is the "Form 3" these have been used to navigate specific JSP page. To identify which form no. you clicked we have used getParameter() method of request object where form name has been passed and checked if this is not equal to null. If it is not, then show that You clicked this particular form. and the rest page is shown as it was earlier.

<HTML>
<HEAD>
<TITLE>JSP WITH  MULTIPLE FORMS</TITLE>
</HEAD>
     <body>
         <center>
         <table width="100%" border="1px" bordercolor="#000080" 
cellpadding="0" cellspacing="0" decolor=""#E2FEFD>
            <tr>
              <td><b><font size="5" color="#333399">JSP WITH
 MULTIPLE FORMS </font></b></td>
            </TR>
            <tr>
               <td height="47" valign="top" bgcolor="#E0EDFD">
                 <br>&nbsp;<b>
	         <%
		     if(request.getParameter("FormName") != null){
	         %>
		 You Clicked <%= request.getParameter("FormName") %>
	         <%}%></b>
                 &nbsp;</td>
             </tr>
             <tr>
               <td>
                  <FORM NAME="form1" METHOD="POST">
                     <INPUT TYPE="HIDDEN" NAME="FormName" VALUE="Form 1">
                     <br><INPUT TYPE="image" SRC="form1.gif">
                  </FORM>
                  <FORM NAME="form2" METHOD="POST">
                     <INPUT TYPE="HIDDEN" NAME="FormName" VALUE="Form 2">
	             <INPUT TYPE="image"  SRC="form-2.gif">
                  </FORM>
                  <FORM NAME="form3" METHOD="POST">
                     <INPUT TYPE="HIDDEN" NAME="FormName" VALUE="Form 3">
                     <INPUT TYPE="image"  SRC="form-3.gif">
                  </FORM>
               </td>
             </tr>
         </table>
         </center>
     </BODY>
</HTML>

OutPut of the Program:

You can download the example by clicking on the following link and copy and paste the complete folder in your webapps folder in TOMCAT after extracting the zip file. And you can run the example by typing the url : http://localhst:8080/JSPMultipleForms/CreatingMultipleForm.jsp .

Download This Example.

                         

» View all related tutorials
Related Tags: c exception error jsp io count page using invoke js handle if to ci counter e directive can pe ce

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 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
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.