index.jsp
<%@ page language="java" pageEncoding="UTF-8"%><%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <body> <form action="${pageContext.request.contextPath}/emp/deleteAll.action" method="POST"> <table border="2" align="center"> <tr> <th>编号</th> <th>姓名</th> </tr> <tr> <td><input type="checkbox" name="ids" value="1"/></td> <td>哈哈</td> </tr> <tr> <td><input type="checkbox" name="ids" value="2"/></td> <td>呵呵</td> </tr> <tr> <td><input type="checkbox" name="ids" value="3"/></td> <td>嘻嘻</td> </tr> <tr> <td><input type="checkbox" name="ids" value="4"/></td> <td>笨笨</td> </tr> <tr> <td><input type="checkbox" name="ids" value="5"/></td> <td>聪聪</td> </tr> <tr> <td> <input type="submit" value="删除"/> </td> </tr> </table> </form> </body></html>
java
import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;@Controller@RequestMapping(value="/emp")public class EmpAction { @RequestMapping(value="/deleteAll",method=RequestMethod.POST) public String deleteAll(Model model,int[] ids) throws Exception{ System.out.println("需要删除的员工编号分别是:"); for(int id : ids){ System.out.print(id+" "); } model.addAttribute("message","批量删除员工成功"); return "/jsp/ok.jsp"; }}
點(diǎn)擊查看更多內(nèi)容
為 TA 點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦