close
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RequestParamExample extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Request Parameters Example</title>");
out.println("</head>");
out.println("<body>");
out.println("<h3>Request Parameters Example</h3>");
out.println("Parameters in this request:<br>");
if (firstName != null || lastName != null) {
out.println("First Name:");
out.println(" = " + HTMLFilter.filter(firstName) + "<br>");
out.println("Last Name:");
out.println(" = " + HTMLFilter.filter(lastName));
} else {
out.println("No Parameters, Please enter some");
}
out.println("<P>");
out.print("<form action=\"");
out.print("RequestParamExample\" ");
out.println("method=POST>");
out.println("First Name:");
out.println("<input type=text size=20 name=firstname>");
out.println("<br>");
out.println("Last Name:");
out.println("<input type=text size=20 name=lastname>");
out.println("<br>");
out.println("<input type=submit>");
out.println("</form>");
out.println("</body>");
out.println("</html>");
}

public void doPost(HttpServletRequest request, HttpServletResponse res)
throws IOException, ServletException
{
doGet(request, response);
}
}
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 alex0126 的頭像
    alex0126

    簡單看的清楚比較重要

    alex0126 發表在 痞客邦 留言(0) 人氣()