麻烦帮我注释以下代码 万分感谢

来源:百度知道 编辑:UC知道 时间:2024/05/15 02:37:00
public class add_banji extends HttpServlet {

public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.print

//首先传递表单的方式肯定是get方式,也就是传递的参数都会在URL上显示出来
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");//返回的内容格式是html格式
PrintWriter out = response.getWriter();//创建输出流对象
//之后的代码其实都其实就是向HTML输出内容嘛,自然地可以发现引号里的内容都是HTML的标准格式。
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");//网页的抬头,也就是在打开网页后左上角显示的内容
out.println(" <BODY>");
out.print(" This is ");//这句话应该可以解释为这是使用get方式传递的
out.print(this.getClass());
out.println(", using the GET method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();//清空输出流,类似于缓存的清空<