- eco_userUpdatePopup.jsp 에 삭제 버튼 추가
1 2 3 4 | <input type="submit" class="btn" value="수정" onclick="userUpdateReload()" data-dismiss="modal"> // 삭제버튼 추가 <input type="button" class="btn" value="삭제" onclick="userUpdateClose()" data-dismiss="modal"> <button type="button" class="btn" data-dismiss="modal" onclick="close()">닫기</button> | cs |
삭제 버튼 클릭시 userUpdateClose() 함수 실행
-eco_user.js
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 | // 사용자 정보수정 - 닫기 function userUpdateClose(){ var DCODE = $("#DCODE").val(); if(confirm("정말 삭제하시겠습니까??") == true){ $.ajax({ type : "POST", url : "/library/userViewDelete.do", dataType : "html", async : true, data : {"DCODE":DCODE}, contentType : "application/json", success : function() { $("#list2").jqGrid({ // jqGrid 리로드 url : '/library/gridView.do', datatype : 'json' }).trigger("reloadGrid"); }, error : function(request, status, error) { console.log("code:" + request.status + "\n" + "message:" + request.responseText + "\n" + "error:" + error); // alert("실패"); } }); } else { // 취소 return; } } | cs |
-controller
1 2 3 4 5 6 7 8 9 10 11 | //사용자 정보 수정 - 삭제하기 @RequestMapping(value = "/userViewDelete.do", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public @ResponseBody void userViewDelete(@RequestBody String DCODE) { System.out.println("userViewDelete.do"); String dcode = DCODE.substring(6); //DCODE값이DCODE=사원번호 이런식으로 넘어온걸 뒤에 번호만 추출 //HttpServletRequest 으로 빼니까 왜인지는 모르겟지만 null값으로 넘어옴.. 그래서 위식으로 뺌 System.out.println(dcode); employeeServiceimp.userViewDelete(dcode); } | cs |
※문자추출 substring
substring(int index); -> int index부터 맨 끝까지 추출
substring(int beginindex,int endindex); -> int index부터 int endindex까지 추출
※
'개발 > 개인' 카테고리의 다른 글
공통코드 테이블 조인 - 사용자상세검색 (0) | 2016.11.15 |
---|---|
사용자 정보조회 - 정렬 (MYBATIS $,IF문) , ON조인구문 활용 (0) | 2016.11.15 |
사용자 정보입력 -사원번호,아이디 중복검사 (0) | 2016.11.10 |
사용자 정보 상세조회2 //replace 사용하기 (0) | 2016.11.09 |
사내도서대여시스템 - 사용자정보 조회2 // 정규식 (0) | 2016.11.08 |
댓글