d063aee9d7d8001b1b6c8c34df20aaed
来自「Internet 开发技术分章节代码和自己完成的课程设计全代码(在zuoye文件」· 代码 · 共 25 行
TXT
25 行
package c9Servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class C9_1 extends HttpServlet
{
//重写doPost方法
public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
{
res.setContentType("text/html"); // 首先设置头信息
PrintWriter out = res.getWriter();// 用 writer方法返回响应数据
out.println("<html><head></head><body>");
out.println("<h1 align=center><b><i><font size=5 face=Arial Black>"+
"The first Servet,So simple!</h1></font></i></b><br>");
out.println("<h2 align=center>You can see that this output is from the SimpleServlet.</h2>");
out.println("</body></html>");
out.close();
}
//重写doGet方法
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException{
doPost(req,res);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?