package myservlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class RegisterServlet extends HttpServlet
{
public void doPost(HttpServletRequest req,HttpServletResponse res) throws
ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Read all Parameters</title></head>");
out.println("<body >");
out.println("<h3>All Parameters From Request</h3>");
out.println("<table border=1 align=left>");
out.println("<tr bgcolor=\"#FFFFFF\">");
out.println("<th>Parameter Name<th>Parameter Value");
Enumeration enuNames=req.getParameterNames();
while(enuNames.hasMoreElements())
{
String strParam=(String)enuNames.nextElement();
out.println("<tr><td>"+strParam+"<td>");
String[] paramValues=req.getParameterValues(strParam);
if (paramValues.length==1)
{
String paramValue=paramValues[0];
if (paramValues.length==0)
评论0
最新资源