removeaction.java
来自「一个简单的struts,用于记录所有计算机的信息」· Java 代码 · 共 32 行
JAVA
32 行
package com.labosun.structs._56837;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.labosun.structs._56837.ComputerDao;
import com.labosun.structs._56837.Computer;
public class RemoveAction extends Action{
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// TODO Auto-generated method stub
String strid=request.getParameter("id");
int id=Integer.parseInt(strid);
ComputerDao dao=ComputerDao.getDao();
Computer c=dao.getComputerById(id);
dao.remove(c);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?