网上书城 购物系统 jsp
挺不错的 大家可以看看 import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class TestContextParamServlet extends HttpServlet { /** * Constructor of the object. */ public TestContextParamServlet() { super(); } /** * Destruction of the servlet. <br> */ 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.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass() + this.getServletConfig().getServletContext().getInitParameter("a")); out.println(", using the GET method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @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 doPost(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.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the POST method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occure */ public void init() throws ServletException { // Put your code here } }
- 1
- 2
- 3
- 4
- 5
- 6
- 8
- 粉丝: 0
- 资源: 1
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- YOLO算法-废物分类数据集-410张图像带标签-瓶子.zip
- YOLO算法-车辆数据集-230张图像带标签-奔驰.zip
- YOLO算法-刀数据集-400张图像带标签-刀.zip
- YOLO算法-列车检测数据集-191张图像带标签-火车.zip
- YOLO算法-易拉罐识别数据集-512张图像带标签-可口可乐.zip
- YOLO算法-水泥路面裂纹检测数据集-213张图像带标签-裂纹.zip
- YOLO算法-道路裂纹数据集-139张图像带标签-裂纹.zip
- YOLO算法-下水道缺陷数据集-2364张图像带标签-关节偏移-障碍物-裂纹-带扣-洞-公用设施入侵-碎片.zip
- YOLO算法-刀具数据数据集-168张图像带标签-刀.zip
- YOLO算法-刀数据集-198张图像带标签-刀-枪.zip
- YOLO算法-检测驾驶员侧车窗是否关闭数据集-85张图像带标签-汽车车窗-汽车.zip
- YOLO算法-树数据集-75张图像带标签-树.zip
- YOLO算法-刀具检测数据集-61张图像带标签-.zip
- YOLO算法-汽车数据集-120张图像带标签-汽车.zip
- YOLO算法-工作场所安全隐患数据集-60张图像带标签-倒下的工人-配备个人防护装备的工人-无个人防护装备的工人-火.zip
- YOLO算法-水泥路面裂纹数据集-42张图像带标签-裂纹.zip