|
@@ -6,12 +6,13 @@ import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
+
|
|
public class HttpDemoServlet extends HttpServlet{
|
|
public class HttpDemoServlet extends HttpServlet{
|
|
|
|
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
resp.addHeader("Content-Type","text/html;charset=utf-8");
|
|
resp.addHeader("Content-Type","text/html;charset=utf-8");
|
|
resp.setCharacterEncoding("UTF-8");
|
|
resp.setCharacterEncoding("UTF-8");
|
|
- resp.getWriter().print("你好 HttpServlet");
|
|
|
|
|
|
+ resp.getWriter().print("<html> <body><h1> 你好 HttpServlet </h1></body> </html>");
|
|
}
|
|
}
|
|
|
|
|
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|