Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
text zoom
Previous: Best Practices in JSP Creating Web Application :Next
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:-
<html>
<head>
<title>Login Form</title>
</head>
<body>
</b></p>
<tr>
<td width="50%"> Login Name</td>
</tr>
<tr>
<td width="50%">Password</td>
</tr>
</table>
</form>
</body>
</html>
JSP page:-
pageEncoding="ISO-8859-1"%>
<html>
<head>
<body>
<tr>
<td><%=request.getParameter("loginName") %></td>
</tr>
<tr>
<td width="50%">Password</td>
<td><%=request.getParameter("password") %></td>
</tr>
</table>
</body>
</html>
Output:- The following screen will be displayed when login form will gets submitted.
* Printer Friendly
* Email to a friend
* Add to my Favourites
* Download PDF version
* Report Bad Submissions
* Submit Feedback
...more
Jsp Source Code
...more
Jsp Related Tutorials
* - Java Tutorial
* - Hibernate Tutorial
* - Spring tutorial
* - Java XML Tutorial
* - JDBC Tutorial
...more
New Jsp Resources
...more
Explore VisualBuilder
Popular Links Popular Links Popular Links Popular Links
* - Java Tutorial
* - EJB 3 Tutorial
* - Spring Tutorial
* - JDBC Tutorial
* - J2EE Design tutorial
* - JSP tutorial
* - Struts tutorial
* - Hibernate tutorial
* - C# Tutorial
* - ASP.NET tutorial
* - ASP Tutorial
* - .NET Tutorial
* - Ajax Tutorial
* - Database Tutorial
* - JSP
* - Java
* - ASP.NET
* - PHP
* - ASP
* - Source Code
* - Components
* - Articles
* - Answers
* - Forum
* - Websites
* - Tutorials
* Contact Us
*|
* Site Index
*|
* Archives
*|
* Terms of Use
*|
* Contributor Policy
*|
* Privacy & Cookies