⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deleteservlet.java

📁 利用Struts的MVC写的WEB开发程序
💻 JAVA
字号:
package player;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import bean.InfoBean;
import flayer.FDelete;

/**
 * Servlet implementation class for Servlet: DeleteServlet
 *
 */
 public class DeleteServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public DeleteServlet() {
		super();
	} 
	
	/* (non-Javadoc)
	 * @see javax.servlet.Servlet#destroy()
	 */
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doService(request,response);

	}  	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doService(request,response);
	}  
	
	protected void doService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		String dDate[] = null;
		
		String userId = "";
		
		int length = 0 ;
	
		userId = (String)request.getSession().getAttribute("USER_ID");
		
		if(request.getParameterValues("checkboxName") != null){
			
			dDate =request.getParameterValues("checkboxName");
			
			length = dDate.length; 
			
		}else{
			
			dDate = new String[0];
						
			length = 0;
			
		}
		
		if(length != 0){
			
			for( int i = 0; i< length; i++){
				
				InfoBean infoBean = new InfoBean();		
			
			    infoBean.setDateSh(dDate[i]);
			    
			    infoBean.setUserId(userId);
			    
			    FDelete deleteInfo = new FDelete();
			    
			    try {
					deleteInfo.deleteInfo(infoBean);
				} catch (SQLException e) {
					// TODO 鑷

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -