This is a very simple example in which we are going to display the name on the browser which we have entered from the Html page.
To get the desired result firstly we have to make one html form which will have only one field named as name in which we will enter the name. And we will also have one submit button, on pressing the submit button the request will go to the server and the result will be displayed to us.
In the servlet which will work as a controller here picks the value from the html page by using the method getParameter(). The output will be displayed to you by the object of the PrintWriter class.
The code of the program is given below:
<html>
|
LoginServlet.java
import java.io.*;
|
web.xml file for this program:
<?xml version="1.0" encoding="ISO-8859-1"?>
|
The output of the program is given below:
![]() |
![]() |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Passing Parameter Using Html Form View All Comments
Post your Comment