Created
January 10, 2019 06:35
-
-
Save minikuma/c02e683d041df15e5981564c9c33ae11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleServlet extends HttpServlet { | |
//doPost 재 정의 | |
@Override | |
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | |
resp.setContentType("text/html; charset=UTF-8"); | |
// Response 객체의 PrintWriter를 사용해 브라우저에 HTML을 출력한다. | |
PrintWriter out = resp.getWriter(); | |
out.println("<HTML><HEAD><TITLE>HelloServlet</TITLE></HEAD>"); | |
out.println("<BODY>"); | |
out.println("<H2> Clinet IP: " + req.getRemoteAddr() + "</H2>"); | |
out.println("<H2> Client Host : " + req.getRemoteHost() + "</H2>"); | |
out.println("<H2> Request URI : " + req.getRequestURI() + "</H2>"); | |
out.println("</BODY></HTML>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment