티스토리 툴바


 <script language="JavaScript">
 <!--
  function allCheck(chkList, boolCheck){
   var chkSize = 0;
   chkSize = chkList.length;
   
   if(typeof(chkSize) != "undefined"){
    for (var i = 0; i < chkSize; i++) {
      chkList[i].checked = boolCheck;
    }
   }
  }
  
  function checkDel(){
   var chkFirList = document.getElementsByName("chck");
   var arrFir = new Array();
   var cnt =0;
   for(var idx=chkFirList.length-1; 0 <= idx ; idx--){
    if(chkFirList[idx].checked){
     arrFir[cnt] = chkFirList[idx].value;
     //alert(arrFir[cnt]);
     cnt++;
    }
   } 
   document.getElementById('firPblictnList').value = arrFir;

   if(arrFir.length != 0){
    document.form.action = "<c:url value='/invest/TbPspmInvest.do?method=deleteTbPspmInvestList'/>";
    document.form.submit();
   }else{
    alert("삭제할 **를 선택하세요.");
    return;
   }
  }

 -->
 </script>

<form name="form"  method="post" >
 <input type="hidden" name="firPblictnList" id="firPblictnList" />
.
.
.
.
  <thead>
   <tr>
    <th scope="col" height="20" class="first"><input type="checkbox" class="checkbox"
      onclick="javascript:allCheck(document.getElementsByName('chck'), this.checked);" />
    </th>
    <th scope="col" >번호</th>
    <th>....</th>
    </thead>
.
.
.

<input type="checkbox" class="checkbox" id="chck" name="chck" value="${tbPspmInvestVO.investSeqNo}"/>
.
.
.
.
</form>





Controller

 //등록, 수정
 public ModelAndView deleteTbPspmInvestList(HttpServletRequest request, HttpServletResponse response)
   throws Exception {
  
  String firPblictnList = request.getParameter("firPblictnList");
  String[] roles = firPblictnList.split(",");

  String url  = "/invest/TbPspmInvest.do?method=selectTbPspmInvestListCity";

  TbPspmInvestVO TbPspmInvestVO = new TbPspmInvestVO();

  for(int i=0 ; i<=roles.length-1 ; i++){
   
   bind(request, TbPspmInvestVO);
   
   TbPspmInvestVO.setInvestSeqNo(roles[i]);
   
   TbPspmInvestVO.setBsshSeqNo(tbPspmInvestService.selectTbPspmBsshSeq(roles[i]));

   tbPspmInvestService.deleteTbPspmInvestList(TbPspmInvestVO);

  }

  return new ModelAndView(url); //this.getSuccess_add()
 }

저작자 표시

'earn a living > JSP' 카테고리의 다른 글

JSP) checkbox (리스트페이지 멀티 체크&삭제)  (0) 2010/11/22
Posted by 환장속의 그대