admin/member2/list.jsp
페이지 정보
작성자 관리자 작성일 23-04-01 18:32 조회 495 댓글 0본문
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/admin/include/header.jsp" %>
<table width=100% height=50 border=0>
<tr>
<td align=center style="color:#777;font-size:14px;font-weight:bold;">[회원관리]</td>
</tr>
</table>
<style>
.td_title{
text-align:center;
font-weight:bold;
}
</style>
<script>
var popupX = (window.screen.width / 2) - (560 / 2);
var popupY= (window.screen.height /2) - (400 / 2);
//상세보기
function popup(str){
window.open("view?id="+str,"view","width=560,height=400,left="+popupX+",top="+popupY);
}
//수정
function popup_modify(str){
window.open("modify?id="+str,"view","width=560,height=400,left="+popupX+",top="+popupY);
}
//삭제
function id_delete(str){
result = confirm("삭제 하시겠습니까?");
if(result == true){
location.href="delete?id="+str;
}
}
</script>
<center>
<table width="700" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Total : ${count }</td>
<td align="right">
<form method="get">
<table border=0>
<tr>
<td>
<select name="field" style="height:20px;">
<option value="id" <c:if test="${field == 'id' }">selected</c:if>>아이디</option>
<option value="name" <c:if test="${field == 'name' }">selected</c:if>>이름</option>
</select>
<input name="search" value="${search }" style="height:16px;">
<button>검색</button>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<script>
function list_change(){
var list = {}; //객체 초기화
for (i = 0; i < list_total.value; i++) {
list.id = $("input[id=m_id]:eq("+i+")").val();
list.pass = $("input[id=m_pass]:eq("+i+")").val();
list.name = $("input[id=m_name]:eq("+i+")").val();
list.age = $("input[id=m_age]:eq("+i+")").val();
list.email = $("input[id=m_email]:eq("+i+")").val();
list.memo = $("textarea[id=m_memo]:eq("+i+")").val();
list.gender = $("select[id=m_gender]:eq("+i+")").val();
list.level = $("select[id=m_level]:eq("+i+")").val();
$.ajax({
url: "modify", //페이지 경로
type: "post", //전송 방식
data: list, //데이터 전달
dataType: "text"
});
}
alert("전체수정 되었습니다.");
}
</script>
<table width=700 border=0 align=center>
<tr bgcolor="#e5ecef" height="40">
<td class="td_title">No</td>
<td class="td_title">아이디<br>비밀번호</td>
<td class="td_title">이름<br>나이</td>
<td class="td_title"></td>
<td class="td_title">메일주소</td>
<td class="td_title">메모</td>
<td class="td_title">성별</td>
<td class="td_title">레벨</td>
<td class="td_title">삭제</td>
</tr>
<c:set var="number" value="${number }" />
<c:set var="list_num" value="0" />
<c:forEach var="list" items="${v }">
<tr height="46">
<td align="center">${number }</td>
<td align="center">
<input id="m_id" value="${list.id }" style="width:100px" readonly>
<div style="height:2px;"></div>
<input id="m_pass" value="${list.pass }" style="width:100px">
</td>
<td align="center">
<input id="m_name" value="${list.name }" style="width:50px">
<div style="height:2px;"></div>
<input id="m_age" value="${list.age }" style="width:50px">
</td>
<td align="center"></td>
<td align="center"><input id="m_email" value="${list.email }" style="width:160px"></td>
<td align="center"><textarea id="m_memo" style="width:160px">${list.memo }</textarea></td>
<td align="center">
<select id="m_gender">
<option value="M" <c:if test="${list.gender eq 'M'}">selected</c:if>>남</option>
<option value="F" <c:if test="${list.gender eq 'F'}">selected</c:if>>여</option>
</select>
</td>
<td align="center">
<select id="m_level">
<option value="1" <c:if test="${list.level eq '1'}">selected</c:if>>1</option>
<option value="10" <c:if test="${list.level eq '10'}">selected</c:if>>10</option>
</select>
</td>
<td align="center">
<span onclick="id_delete('${list.id }')" style="cursor:pointer">[삭제]</span>
</td>
</tr>
<tr><td colspan=9 height=1 bgcolor="#e5ecef"></td></tr>
<c:set var="number" value="${number - 1 }" />
<c:set var="list_num" value="${list_num + 1 }" />
</c:forEach>
<input type="hidden" id="list_total" value="${list_num}">
</table>
<br>
<!-- 페이징 처리 -->
<style>
.page_on {
padding:0px 5px;
color:red;
border:1px solid red;
font-weight:bold;
}
.page_off {
padding:0px 5px;
color:black;
border:1px solid black;
}
</style>
<table width=700 border=0>
<tr>
<td>
<c:if test="${count>0 }">
<c:set var="pageCount" value="${count / pageSize + (count % pageSize == 0 ? 0 : 1) }" />
<fmt:parseNumber var="pageCount" value="${pageCount }" integerOnly="true" />
<!-- fmt:parseNumber : 문자열을 숫자로 변환해 주는 기능을 제공하는 태그 -->
<!-- integerOnly : true , false 정수만 출력할 것인지를 묻는 속성 -->
<!-- 2개의 변수 초기화 -->
<c:set var="startPage" value="${1 }" />
<c:set var="pageBlock" value="${3 }" />
<!-- 다음 페이지 블럭이 존재 할 경우 startPage 값 변경 부분-->
<c:if test="${pageNum > pageBlock }">
<!-- 결과를 정수형으로 리턴 받아야 하기 대문에 fmt -->
<fmt:parseNumber var="result" value="${pageNum / pageBlock - (pageNum % pageBlock == 0 ? 1:0) }" integerOnly="true"/>
<c:set var="startPage" value="${result * pageBlock + 1 }" />
</c:if>
<!-- endPage 값 설정 부분 -->
<c:set var="endPage" value="${startPage + pageBlock - 1 }" />
<c:if test="${endPage > pageCount }">
<c:set var="endPage" value="${pageCount }" />
</c:if>
<!-- 이전 링크 -->
<c:if test="${startPage > pageBlock }">
<a href="list?pageNum=${startPage - pageBlock }&field=${field}&search=${search}">[이전] </a>
</c:if>
<!-- 페이징 링크 -->
<c:forEach var="i" begin="${startPage }" end="${endPage }">
<c:choose>
<c:when test="${pageNum == i }">
<a href="list?pageNum=${i }&field=${field}&search=${search}"><span class="page_on"><font color=red><b>${i }</b></font></span></a>
</c:when>
<c:otherwise>
<a href="list?pageNum=${i }&field=${field}&search=${search}"><span class="page_off">${i }</span></a>
</c:otherwise>
</c:choose>
</c:forEach>
<!-- 다음 링크 -->
<c:if test="${endPage < pageCount }">
<a href="list?pageNum=${startPage + pageBlock }&field=${field}&search=${search}">[다음] </a>
</c:if>
</c:if>
</td>
<td align="right">
<span onclick="list_change()" style="cursor:pointer;color:red">[전체수정]</span>
<a href="write">[회원등록]</a>
</td>
</tr>
</table>
</center>
<br>
<%@ include file="/admin/include/footer.jsp" %>
댓글목록 0
등록된 댓글이 없습니다.