티스토리 뷰

Spring

SPRING 리스트 기능 순서 흐름

piern 2018. 12. 14. 04:09

1. BoardDAO.java : 인터페이스

public List<BoardVO> listAll() throws Exception;


2. mapper

<select id="listAll" resultType="org.zerock.domain.BoardVO">

<![CDATA[

SELECT 

   bno, title, content, writer, regdate, viewcnt 

FROM 

   tbl_board 

WHERE bno > 0 

ORDER BY bno desc, regdate desc

]]>

</select>


3. BoardDAOImpl.java

@Override

  public List<BoardVO> listAll() throws Exception {

    return session.selectList(namespace + ".listAll");

  }


4. BoardService.java : 인터페이스

public List<BoardVO> listAll() throws Exception;\


5. BoardServiceImpl.java

@Override

  public List<BoardVO> listAll() throws Exception {

    return dao.listAll();

  }


6. BoardController.java

@RequestMapping(value = "/listAll", method = RequestMethod.GET)

  public void listAll(Model model) throws Exception {


    logger.info("show all list......................");

    model.addAttribute("list", service.listAll());

  }


7. listAll.jsp

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

pageEncoding="UTF-8"%>

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

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

<%@ page session="false"%>


<%@include file="../include/header.jsp"%>


<!-- Main content -->

<section class="content">

<div class="row">

<!-- left column -->

<div class="col-md-12">

<!-- general form elements -->


<div class="box">

<div class="box-header with-border">

<h3 class="box-title">LIST ALL PAGE</h3>

</div>

<div class="box-body">


<table class="table table-bordered">

<tr>

<th style="width: 10px">BNO</th>

<th>TITLE</th>

<th>WRITER</th>

<th>REGDATE</th>

<th style="width: 40px">VIEWCNT</th>

</tr>



<c:forEach items="${list}" var="boardVO">


<tr>

<td>${boardVO.bno}</td>

<td><a href='/board/read?bno=${boardVO.bno}'>${boardVO.title}</a></td>

<td>${boardVO.writer}</td>

<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm"

value="${boardVO.regdate}" /></td>

<td><span class="badge bg-red">${boardVO.viewcnt }</span></td>

</tr>


</c:forEach>


</table>


</div>

<!-- /.box-body -->

<div class="box-footer">Footer</div>

<!-- /.box-footer-->

</div>

</div>

<!--/.col (left) -->


</div>

<!-- /.row -->

</section>

<!-- /.content -->

</div>

<!-- /.content-wrapper -->


<script>

    

    var result = '${msg}';

    

    if(result == 'SUCCESS'){

    alert("처리가 완료되었습니다.");

    }

    

    </script>


<%@include file="../include/footer.jsp"%>

'Spring' 카테고리의 다른 글

SPRING 삭제 기능 순서 흐름  (0) 2018.12.14
SPRING 조회 기능 순서 흐름  (0) 2018.12.14
SPRING 저장 기능 순서 흐름  (0) 2018.12.14
Mybatis 에러  (0) 2018.04.11
mybatis selectKey  (0) 2018.03.26
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/11   »
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
글 보관함