Created
February 4, 2013 13:15
-
-
Save bouzuya/4706681 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package com.github.bouzuya; | |
| import java.io.*; | |
| import javax.servlet.*; | |
| import javax.servlet.http.*; | |
| public class ServletExample extends HttpServlet { | |
| public void doGet(HttpServletRequest request, HttpServletResponse response) | |
| throws ServletException, IOException { | |
| String title = "ServletExample"; | |
| String content = "Hello, World!"; | |
| response.setContentType("text/html; charset=UTF-8"); | |
| PrintWriter out = response.getWriter(); | |
| out.println("<!DOCTYPE html>"); | |
| out.println("<html lang=\"en\">"); | |
| out.println(" <head>"); | |
| out.println(" <title>" + title + "</title>"); | |
| out.println(" </head>"); | |
| out.println(" <body>"); | |
| out.println(" <p>" + content + "</p>"); | |
| out.println(" </body>"); | |
| out.println("</html>"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment