All the time we are accustomed to read client data with getParameter() method, most probably from HTML text fields. But, HTML FORM tag includes many GUI components like radio buttons, SELECT drop down lists, text areas etc. This Client HTML comes with rarely used FORM fields. To do with, a Student Feedback Form is designed where a Student completes his course from an institute and gives feedback of Faculty and Institute amenities.
Servlet Example
To read all the FORM fields, getParameterNames() of HttpServletRequest is used. The feedback data is read by Servlet and sent back to client in a table format.
Feedback Form
snrao1
StudentFeedback
snrao1
/SF
import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.*;
public class StudentFeedback extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter pw = res.getWriter();
java.util.Enumeration e = req.getParameterNames();
pw.println("");
while(e.hasMoreElements())
{
String fieldname = (String) e.nextElement();
String value = req.getParameter(fieldname);
if(value.length() != 0)
{
pw.println("");
}
else
{
pw.println("");
}
}
pw.println("
" + fieldname + " | " + value + " |
---|---|
" + fieldname + " | Null |
java.util.Enumeration e = req.getParameterNames();
The getParameterNames() method of javax.serlet.ServletRequest inherited by javax.servlet.http.HttpServletRequest returns an object of Enumeration. This step is explained earlier in Get all parameters of HTML form.
HTML file when all fields are entered.

Output screen of Servlet Example: Client data put in a table

Output screen of Servlet Example with data tabulated
here localhost:8888/india/SF
what exactly it is please explain