package com.course.action; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.ServletActionContext; import com.course.service.IAdminService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class DelCourseAction extends ActionSupport { IAdminService adminService; public IAdminService getAdminService() { return adminService; } public void setAdminService(IAdminService adminService) { this.adminService = adminService; } @Override public String execute() throws Exception { HttpServletRequest request=ServletActionContext.getRequest(); int id=Integer.parseInt(request.getParameter("id")); adminService.delCourse(adminService.getCourseById(id)); return SUCCESS; } }