본문 바로가기
프로그래밍언어/패턴, 알고리즘, 프로토콜

STRUTS2+iBatis 계층형 게시판 만들기 (4)

by plog 2009. 12. 14.


4. 뷰어 부분
 보드 리스트를 출력하는 뷰어 부분이다.
 css  부분은 쟁량껏 삭제 또는 수정하여 보면 됩니다.

- 핵심 코드
<div id="content">
    <!-- table list-->
    <table class="gray-listA">
     <thead>
      <tr class="align-center">
         <th width="5%">글번호</th>
         <th width="10%">분류</th>
         <th width="30%">제목</th>
         <th width="10%">글쓴이</th>
         <th width="20%">작성날짜</th>
         <th width="20%">수정날짜</th>
         <th width="5%">조회수</th>
      </tr>
     </thead>
     <tbody>
     <s:iterator value="data">
      <s:url action="boardViewer" includeParams="none" id="boardViewer">
         <s:param name="boardNo"><s:property value="boardNo"></s:property></s:param>
         <s:param name="contentNo"><s:property value="contentNu"></s:property></s:param>
         <s:param name="pageNo"><s:property value="pageNo"></s:property></s:param>
      </s:url>
         <tr>                  
              <td width="5%"><s:property value="contentNu"></s:property></td>
              <td width="10%"><s:property value="kind"></s:property></td>
              <s:a href="%{boardViewer}" ><td width="30%"><s:property value="title"></s:property></td></s:a>
              <td width="10%"><s:property value="writer"></s:property></td>
              <td width="20%"><s:property value="%{parserTime(writeDt)}"></s:property></td>
              <td width="20%"><s:property value="%{parserTime(adjustDt)}"></s:property></td>
              <td width="5%"><s:property value="counts"></s:property></td>
         </tr>
        </s:iterator>
     </tbody>
    </table>

    <br />
    <!-- 그룹 표기 및 이동 출력 부분-->      
     <table align="center">
     <tr><td>
      <s:url action="boardList" includeParams="none" id="boardList">
         <s:param name="boardNo"><s:property value="boardNo"></s:property></s:param>
         <s:param name="pageNo"><s:property value="prevGroupPage"></s:property></s:param>
      </s:url>
      <s:a href="%{boardList}">Prev</s:a>
     </td>
      
     <s:iterator value="pageSizeArray"  status="stat">
         <td>
         <s:url action="boardList" includeParams="none" id="boardList">
             <s:param name="boardNo"><s:property value="boardNo"></s:property></s:param>
             <s:param name="pageNo"><s:property value="pageNumber"></s:property></s:param>
         </s:url>
         <s:a href="%{boardList}">[<s:property value="pageNumber"></s:property>]</s:a>
         </td>
     </s:iterator>
     <td>
      <s:url action="boardList" includeParams="none" id="boardList">
          <s:param name="boardNo"><s:property value="boardNo"></s:property></s:param>
          <s:param name="pageNo"><s:property value="nextGroupPage"></s:property></s:param>
      </s:url>
      <s:a href="%{boardList}">Next</s:a>
     </td></tr>
     </table>
     <div class="btn-right">
     <s:url action="boardWrite" includeParams="none" id="boardWrite">
          <s:param name="boardNo"><s:property value="boardNo"></s:property></s:param>
     </s:url>
     <s:a href="%{boardWrite}">글쓰기</s:a>
       </div>
   </div>

댓글