The Body of Index.jsp page
<form action=servlet/First_Servlet method="post"> <br>
First_Name<input type="text" name="user_name">
<input type="submit" value="Submit" >
</form> <br>
</body>
First_Servlet
import javax.servlet.*;
import java.util.Enumeration;
import java.io.IOException;
public class First_Servlet implements Servlet {
public void destroy() {
// TODO Auto-generated method stub
}
public ServletConfig getServletConfig() {
// TODO Auto-generated method stub
return null;
}
public String getServletInfo() {
// TODO Auto-generated method stub
return null;
}
public void init(ServletConfig config) throws ServletException {
// TODO Auto-generated method stub
}
public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
System.out.println("server_port_Number++++++++++++++++++++++++++++++++++++++++++++++++++++" +req.getServerPort());
System.out.println("Server_Name"+ req.getServerName());
System.out.println("Protocol" +req.getProtocol());
System.out.println("charcter encoding" +req.getCharacterEncoding() );
Enumeration parameter= req.getParameterNames();
while(parameter.hasMoreElements())
{
String parameter_name=(String)parameter.nextElement();
System.out.println("parameter_name"+parameter_name);
System.out.println("parameter_value"+req.getParameter(parameter_name));
}
Enumeration attributes= req.getAttributeNames();
while(attributes.hasMoreElements())
{
String attribute= (String)attributes.nextElement();
System.out.println("parameter_name"+attribute);
System.out.println("parameter_value"+req.getParameter(attribute));
}
}