public class ErrorServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setCharacterEncoding("UTF-8");//编码方式
resp.setContentType("text/html");//设置为html格式
PrintWriter writer = resp.getWriter();
writer.write("<h1>这是错误页面<h1/>");
}
Servlet输出html页面
最新推荐文章于 2023-10-29 21:21:24 发布