- Sevlet Code:
- import java.io.*;
- import java.util.*;
- import javax.servlet.*;
- public class PostParam extends GenericServlet
- {
- public void service(ServletRequest request,ServletResponse response) throws
- ServletException,IOException
- {
- PrintWriter pw = response.getWriter();
- Enumeration e = request.getParameterNames();
- while(e.hasMoreElements())
- {
- String pname = (String)e.nextElement();
- pw.print(pname + " = ");
- String pvalue = request.getParameter(pname);
- pw.println(pvalue);
- }
- pw.close();
- }
- }
- HTML CODE:
- <HTML>
- <head>
- <TITLE>INVOKING SERVLET FROM HTML</TITLE>
- </head>
- <BODY>
- <CENTER>
- <FORM name = "PostParam" method = "Post" action="http://localhost:8084/IP/PostParam">
- <TABLE>
- <tr>
- <td><B>Employee </B> </td>
- <td><input type = "textbox" name="ename" size="25"
- value=""></td>
- </tr>
- <tr>
- <td><B>Phone </B> </td>
- <td><input type = "textbox" name="phoneno" size="25"
- value=""></td>
- </tr>
- </TABLE>
- <INPUT type = "submit" value="Submit">
- </FORM>
- </CENTER>
- </body>
- </html>