<script type="text/javascript">
function editcar() {
var carId="";
var checknum=0;
var s=document.getElementsByTagName("input");
for (var i=0;i<s.length;i++) {
if (s[i].getAttribute("name")=="checkbox")
if (s[i].checked){
checknum++;
carId+=s[i].value;
}
}
if (checknum!=1) {
alert("請(qǐng)選擇一輛需要修改的車輛!");
return false;
}
location.href="<%=basePath%>car.do?method=editCar&carid="+carId;
}
function delsome() {
if(confirm("你確定要?jiǎng)h除所選車輛信息嗎?")){
var choice="";
var s=document.getElementsByTagName("input");
for (var i=0;i<s.length;i++) {
if (s[i].getAttribute("name")=="checkbox")
if (s[i].checked)
choice+=s[i].value+",";
}
if (choice)
location.href="<%=basePath%>car.do?method=delCar&carId="+choice;
else
alert("請(qǐng)選擇需要?jiǎng)h除的車輛!")
}
}
</script>
標(biāo)簽代碼:
<input name="checkbox" type="checkbox" id="checkbox" value="${car.carId }">
刪除部分的Action代碼:
public ActionForward delCar(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String carId = request.getParameter("carId");
carService.delCar(carId);
return query(mapping,form,request,response);
}
service部分代碼:
public void delCar(String carId) {
String arryId[] = carId.split(",");
for (int i = 0; i < arryId.length; i++) {
// SrcmCar car = new SrcmCar();
// car.setCarId(arryId[i]);
// this.getHibernateTemplate().delete(car);
String hql = "delete from SrcmCar where carId='" + arryId[i] + "'";
Query query = this.getSession().createQuery(hql);
query.executeUpdate();
}
}
只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
|
||
相關(guān)文章:
|
||
| |||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
---|---|---|---|---|---|---|---|---|---|
30 | 1 | 2 | 3 | 4 | 5 | 6 | |||
7 | 8 | 9 | 10 | 11 | 12 | 13 | |||
14 | 15 | 16 | 17 | 18 | 19 | 20 | |||
21 | 22 | 23 | 24 | 25 | 26 | 27 | |||
28 | 29 | 30 | 31 | 1 | 2 | 3 | |||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
常用鏈接
留言簿(4)
隨筆分類
- AJAX(2)
- CSS(4)
- freemarker
- hibernate
- HTML/XML(6)
- Jasper Report(1)
- javascript(26)
- java編程(20)
- JSP基礎(chǔ)(4)
- oracle(18)
- spring(1)
- struts(3)
- 其他(13)
- 架構(gòu)設(shè)計(jì)(2)
- 編碼規(guī)范
- 設(shè)計(jì)模式(1)
隨筆檔案
- 2012年8月 (1)
- 2011年4月 (2)
- 2011年2月 (2)
- 2010年8月 (9)
- 2010年7月 (1)
- 2009年11月 (2)
- 2009年10月 (3)
- 2009年9月 (11)
- 2009年8月 (4)
- 2009年6月 (7)
- 2008年12月 (1)
- 2008年10月 (3)
- 2008年8月 (4)
- 2008年7月 (1)
- 2008年6月 (2)
- 2008年4月 (2)
- 2008年3月 (1)
- 2008年2月 (1)
- 2008年1月 (3)
- 2007年12月 (15)
- 2007年11月 (14)
- 2007年10月 (12)
- 2007年8月 (2)
搜索
最新評(píng)論

- 1.?re: Blowfish加密算法之Java實(shí)現(xiàn)[未登錄]
- 這個(gè)有c語(yǔ)言版沒
- --小丸子
- 2.?re: SSH實(shí)現(xiàn)分頁(yè)
-
我和上面的一樣,你的分頁(yè)很簡(jiǎn)單,能否發(fā)一份給我呢?
我的QQ郵箱是511775600@qq.com - --瞇露
- 3.?re: String.equals()和String.equalsIgnoreCase()的區(qū)別
- 觀后感矛
- --和規(guī)劃局
- 4.?re: 時(shí)間控件(可含時(shí)分秒)
- thank you 樓主
- --yaoj
- 5.?re: 時(shí)間控件(可含時(shí)分秒)
- 評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
- --末日風(fēng)情