Upreason_sh.java 2.8 KB
package com.servlet.bksh.DMC;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.service.bksh.SHExecuteService;
import com.vo.SH_reason_DataManage;

public class Upreason_sh extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

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

		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html");
		SH_reason_DataManage shDataManage = new SH_reason_DataManage();
		boolean re = true;
		shDataManage.setA_datetime(request.getParameter("a_datetime"));
		shDataManage.setA_point(request.getParameter("a_point"));
		shDataManage.setA_type(request.getParameter("a_type"));
		shDataManage.setA_reason(request.getParameter("a_reason"));
		SHExecuteService service = new SHExecuteService();
		//String id = request.getParameter("a_id");
			re = service.updatereasondata(shDataManage);	
		if (!re) {
			response.getWriter().print("{success:true,msg:'数据操作成功'}");
			response.getWriter().close();
		} else {
			response.getWriter().print("{success:true,msg:'数据操作失败,请检查时间是否正确'}");
			response.getWriter().close();
		}
	}
	
	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}