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

📄 deleteeventaction.java

📁 使用eclipse开发的web程序
💻 JAVA
字号:
package com.wrox.tourism.actions;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionServlet;

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

import java.io.IOException;

import java.sql.Connection;
import java.sql.SQLException;

import java.util.Collection;

import com.wrox.tourism.business.EventBO;
import com.wrox.tourism.entity.Attraction;

public class DeleteEventAction extends Action {

  public ActionForward perform(ActionMapping mapping,ActionForm form,
    HttpServletRequest request,HttpServletResponse response)
      throws IOException,ServletException {

    ActionErrors errors = new ActionErrors();

    try {

      int eventId = Integer.parseInt(
        request.getParameter("eventId"));

      EventBO eventBO = new EventBO();
      eventBO.removeEvent(eventId);

      return mapping.findForward("success");

    } catch (Throwable e) {
      e.printStackTrace();
      ActionError error = new ActionError(e.getMessage());
      errors.add(ActionErrors.GLOBAL_ERROR,error);
    }
    saveErrors(request,errors);
    return new ActionForward(mapping.getInput());

  }

}

⌨️ 快捷键说明

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