?? deleteeventaction.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 + -