728x90

 

 

페이징 처리(페이지네이션)

중간에 보고 있는 현재 번호(currentPage) 외에 이전(prev), 다음(next) 버튼이 따로 있고

이들은 currentPage번호보다 작거나 커야함

그리고 각각 1과 마지막 번호(maxPage)의 경우가 있어서 따로 <c:if>로 작성 해야하는 구조임. 구조파악 완료

 

<!-- 페이징 처리 -->
<tr align="center" height="20" id="buttonTab">
    <td colspan="6">
        <!-- [이전] -->
        <c:if test="${ pi.currentPage <= 1 }">
            [이전] &nbsp; <!-- 1페이지에서만 나오는 기호 설정. 마찬가지로 마지막페이지에서 나오는 기호도 따로 지정해줘야함 -->
        </c:if>
        <c:if test="${ pi.currentPage > 1 }">
            <c:url var="before" value="blist.bo">
                <c:param name="page" value="${ pi.currentPage - 1 }"/>
            </c:url>
            <a href="${ before }">[이전]</a>
        </c:if>

        <!-- 페이지 번호 -->
        <c:forEach var="p" begin="${ pi.startPage }" end="${ pi.endPage }">
            <c:if test="${ p eq pi.currentPage }">
                <font color="red" size="4"><b>[${ p }]</b></font>
            </c:if>
            <c:if test="${ p ne pi.currentPage }">
                <c:url var="pagination" value="blist.bo">
                    <c:param name="page" value="${ p }"/>
                </c:url>
                <a href="${ pagination }">${ p }</a> &nbsp;
            </c:if>
        </c:forEach>

        <!-- [다음] -->
        <c:if test="${ pi.currentPage >= pi.maxPage }">
            [다음]		<!-- 마지막 페이지에서만 나오는 기호 설정. 마찬가지로 첫페이지에서 나오는 기호도 따로 지정해줘야함 -->
        </c:if>
        <c:if test="${ pi.currentPage < pi.maxPage }">
            <c:url var="after" value="blist.bo">
                <c:param name="page" value="${ pi.currentPage + 1 }"/>
            </c:url>
            <a href="${ after }">[다음]</a>
        </c:if>

    </td>
</tr>
728x90
반응형
728x90

 

반복 반복

머리에 기억되도록 반복

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title> practice </title>
<link rel="stylesheet" type="text/css" href="${pageContext.servletContext.contextPath }/resources/css/member-style.css">

</head>
<body>

	<c:import url="../common/menubar.jsp"/>
	
	<h1 align="center">${loginUser.name }님의 정보 수정</h1>
	
	<div class="centerText">
		<form action="mupdate.me" method="post">
			<table>
				<tr>
					<th>아이디</th>
					<td>${loginUser.id }<input type="hidden" name="id" value="${loginUser.id }"></td>
				</tr>
				<tr>
					<th>이름</th>
					<td><input type="text" name="name" value="${loginUser.name }"></td>
				</tr>
				<tr>
					<th>닉네임</th>
					<td><input type="text" name="nickName" value="${loginUser.nickName }"></td>
				</tr>
				<tr>
					<th>성별</th>
					<c:if test="${ loginUser.gender == 'M' }">
						<td>
							<input type="radio" name="gender" value="M" checked>남
							<input type="radio" name="gender" value="F">여
						</td>
					</c:if>
					<c:if test="${ loginUser.gender == 'F' }">
						<td>
							<input type="radio" name="gender" value="M">남
							<input type="radio" name="gender" value="F" checked>여
						</td>
					</c:if>
				</tr>
				<tr>
					<th>나이</th>
					<td><input type="number" name="age" value="${loginUser.age }" min="18" max="100"></td>
				</tr>
				<tr>
					<th>이메일</th>
					<td><input type="email" name="email" value="${loginUser.email }"></td>
				</tr>
				<tr>
					<th>전화번호</th>
					<td><input type="tel" name="phone" value="${ loginUser.phone }"></td>
				</tr>
				
				
				<c:forTokens var="ft" items="${ loginUser.address }" delims="/" varStatus="vs">
					<c:if test="${ vs.index eq 0 && ft >= '0' && ft <= '99999' }">
						<c:set var="post" value="${ ft }"/>
					</c:if>
					<c:if test="${ vs.index eq 0 && !(ft >= '0' && ft <= '99999') }">
						<c:set var="address1" value="${ ft }"/>
					</c:if>
					<c:if test="${ vs.index eq 1 }">
						<c:set var="address1" value="${ ft }"/>
					</c:if>
					<c:if test="${ vs.index eq 2 }">
						<c:set var="address2" value="${ ft }"/>
					</c:if>			
				</c:forTokens>
				
				<tr>
					<th>우편번호</th>
					<td>
						<input type="text" name="post" class="postcodify_postcode5" value="${ post }" size="6">
						<button type="button" id="postcodify_search_button">검색</button>
					</td>
				</tr>
				<tr>
					<th>도로명 주소</th>
					<td>
						<input type="text" name="address1" class="postcodify_address" value="${address1 }" size="30">
					</td>
				</tr>
				<tr>
					<th>상세 주소</th>
					<td>
						<input type="text" name="address2" class="postcodify_extra_info" value="${ address2 }" size="30">
					</td>
				</tr>
				
				
				<!-- jQuery와 Postcodify를 로딩한다. -->
				<script src="//d1p7wdleee1q2z.cloudfront.net/post/search.min.js"></script>
				<script>
					// 검색 단추를 누르면 팝업 레이어가 열리도록 설정한다.
					$(function(){
						$("#postcodify_search_butto").postcodifyPopUp();
					});
				</script>
				
				<tr>
					<td colspan="2" align="center">
						<input type="submit" value="수정하기">
						<c:url var="mdelete" value="${ loginUser.id }">
							<c:param name="id" value="${ loginUser.id}"/>
						</c:url>
						<button type="button" onclick="location.href='${ mdelete }'">탈퇴하기</button>
						<button type="button" onclick="location.href='home.do'">시작 페이지로</button>
					</td>
				</tr>
				
			</table>
		</form>
	</div>



</body>
</html>
728x90
반응형
728x90

 

 

&nbsp;

 공백을 표시하기 위한 특수문자

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>prac</title>

<style type="text/css">
	#tb{margin:auto; width:700px; border-collapse:collapse;}
	#tb tr td{padding: 5px}
	#buttonTab{border-left: hidden; border-right:hidden;}

</style>

</head>
<body>


	<c:import url="..common/menubar.jsp"/>
	
	<h1 align="center">게시글 목록</h1>
	<h3 align="center"> 총 게시글 갯수 : ${pi.listCount }</h3>
	
	<table border="1" id="tb">
		<!-- 제목 tr -->
		<tr style="background: yellowgreen;">
			<th>번호</th>
			<th width="300">제목</th>
			<th>작성자</th>
			<th>날짜</th>
			<th>조회수</th>
			<th>첨부파일</th>
		</tr>
		<!-- 내용 tr -->
		<c:forEach var="b" items="${list}">
			<tr class="contentTr">
				<td align="center">${b.boardId }</td>
				<td align="center">${b.boardTitle }</td>
				<td align="center">${b.boardWriter}</td>
				<td algin="center">${b.boardCreateDate }</td>
				<td algin="center">${b.boardCount }</td>
				<td align="center"></td>			
				<td align="left">
					<c:if test="${ !empty b.originalFileName }">
						◎
					</c:if>
				</td>		
			</tr>
		</c:forEach>	
		<!-- 글쓰기 버튼 tr  -->
		<tr>
			<td colspan="6" align="right" id="buttonTab">
				<c:if test="${!empty loginUser }">
					&nbsp; &nbsp; &nbsp; <!-- &nbsp; : 공백을 표시하기 위한 특수문자 -->
					<button onclick="location.href='binsertView.bo';">글쓰기</button>
				</c:if>
			</td>
		</tr>
		
		<!-- 페이징처리 tr -->
		
		
		
	</table>
	
	
	<script>
	
	
	</script>


</body>
</html>
728x90
반응형

+ Recent posts