首页>代码>java使用JDBC连接MySQL数据库操作电子图书增删改查项目实例>/jdbc连接数据库-源码/ebookentry-JDBC/src/servlet/idServlet.java
package servlet;

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 idServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public idServlet() {
		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 {

		doPost(request, response);
	}

	/**
	 * 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();
		
		int id=Integer.parseInt(request.getParameter("id"));
		request.getSession().setAttribute("idid", id);
		response.sendRedirect("Update.jsp");
		
		out.flush();
		out.close();
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
最近下载更多
y1214435276  LV9 4月11日
asddwh  LV12 2023年12月26日
321170193  LV6 2023年11月12日
jiemomo  LV12 2023年10月19日
liuliuyl  LV3 2023年6月17日
哇呜呜  LV1 2023年6月13日
微信网友_6260196253601792  LV7 2022年12月16日
wwb521  LV7 2022年11月28日
最近浏览更多
一起加油  LV4 4月19日
y1214435276  LV9 4月11日
Kaiaahh  LV1 1月4日
放鞭炮  LV1 2023年12月26日
微信网友_5986558820093952  LV3 2023年12月26日
asddwh  LV12 2023年12月25日
eqeqleqeqn  LV1 2023年12月22日
颜菜菜  LV2 2023年12月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友