You are currently using guest access (Login)
Help with Search
 
 
Picture of s10175 k
GetPostName
by s10175 k - Monday, 22 October 2012, 11:48 AM
 

http://192.168.121.140/tomcat/GetPostName.html

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();
                out.println("<HTML>");
                out.println("<HEAD>");
                out.println("<TITLE>Get Name</TITLE>");
                out.println("</HEAD>");

                out.println("<BODY>");
                out.println("<H1>GET Method</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>");

}

        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();
                out.println("<HTML>");

 out.println("<HEAD>");
                out.println("<TITLE>Post Name</TITLE>");
                out.println("</HEAD>");

                out.println("<BODY>");
                out.println("<H1>POST Method</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>");

        }
}

 

Picture of s10175 k
Re: GetPostName
by s10175 k - Monday, 22 October 2012, 12:30 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();
                a(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();
                a(out,firstname,secondname,"POST");
        }
        public void a(PrintWriter out,String firstname,String secondname,String b){
                out.println("<HTML>");
                out.println("<HEAD>");
                out.println("<TITLE>Name</TITLE>");
                out.println("</HEAD>");

                out.println("<BODY>");
                out.println("<H1>"+ b + " </H1>");
                out.println("<BR>");
                out.println("<H2>あなたのファーストネームは ");
                out.println("<FONT COLOR=#C01010>"+firstname+"</FONT></H2>");

     out.println("<H2>あなたのセカンドネームは ");
                out.println("<FONTCOLOR=#C01010>"+secondname+"</FONT></H2>");
                out.println("</BODY>");
                out.println("</HTML>");

        }
}

Skip Navigation

Navigation


You are currently using guest access (Login)