
The previous section has explained what all controls are used in HTML for creating the forms. Lets see with the help of below example how do we get the form data in JSP page which is send by the user.
We need to first define which JSP page should be accessed when this form is submitted. This can be achieved by the action attribute in the <form>. For example:- <form action="/login.jsp"> will generate a request for the login.jsp page when the submit button will be clicked for the form.
We will be creating the input1.jsp file which will show the data which user has sent from login.html page from the previous example.
Example:-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <head> <body> <p align="left"><b>Login Form </b></p> <form method="POST" action="login.jsp" name="loginForm"> <table border="1" width="50%" cellspacing="1" cellpadding="0" id="table1"> </body> </html> |
JSP page:-
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
Output:- The following screen will be displayed when login form will gets submitted.
Jsp Discussion
- - Two forms in one JSP
- - PASS VARIABLES BETWEEN 2
- - Table data
- - Unable to laod the image
- - The Ultimate Web UI Frame




