html回传

  1. 1. html回传

html回传

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.atguigu.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class PringHtml extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

resp.setContentType("text/html; charset=UTF-8");
PrintWriter writer = resp.getWriter();
writer.write("<!DOCTYPE html>\r\n");
writer.write("<html lang=\"en\">\n");
writer.write("<head>");
writer.write("<meta charset=\"UTF-8\">\n");
writer.write("<title>try</title>\n");
writer.write("</head>\n");
writer.write("这里是html回传见面\n");
writer.write("</body>\n");
writer.write("</html>\n");
System.out.println("html回传成功");
}
}