You are currently using guest access (Login)
Help with Search
 
 
Picture of s10032 imo
GETPOSTName.java
by s10032 imo - Monday, 22 October 2012, 01:06 PM
 

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

  public class GetPostName extends HttpServlet {
 public void doGet(HttpServletRequest request, HttpServletResponse response)
 throws IOException, ServletException{
response.setContentType("text/html; charset=UTF-8");
request.setCharacterEncoding("UTF-8");
String firstname = request.getParameter("fname");
String secondname = request.getParameter("sname");
PrintWriter out = response.getWriter();
o(out,firstname,secondname,"GET");

}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
response.setContentType("text/html; charset=UTF-8");
request.setCharacterEncoding("UTF-8");
String firstname = request.getParameter("fname");
String secondname = request.getParameter("sname");
PrintWriter out = response.getWriter();
o(out,firstname,secondname,"POST");
}
public void o(PrintWriter out,String firstname,String secondname,String a){
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>"+a+" </TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<H1>"+a+"</H1>");
out.println("<BR>");
out.println("<H2>あなたのファーストネームは ");
out.println("<FONT COLOR=#C01010>"+firstname+"</FONT></H2>");
out.println("<H2>あなたのセカンドネームは ");
out.println("<FONT COLOR=#C01010>"+secondname+"</FONT></H2>");
out.println("</BODY>");
out.println("</HTML>");
}
}

Skip Navigation

Navigation


You are currently using guest access (Login)