본문 바로가기

기존카테고리/JSP

list 추출에서 pageContext 사용

 

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

 

<h3 class="hidden">공지사항 목록</h3>

<table class="table">

<thead>

<tr>

<th class="w60">번호</th>

<th class="expand">제목</th>

<th class="w100">작성자</th>

<th class="w100">작성일</th>

<th class="w60">조회수</th>

</tr>

</thead>

<tbody>

<%-- <%

List<Notice> list = (List<Notice>)request.getAttribute("list");

for(Notice n : list){

pageContext.setAttribute("n", n);

%> --%>

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

<tr>

<td>${n.id}</td>

<td class="title indent text-align-left"><a href="detail?id=${n.id}">${n.title}</a></td>

<td>${n.writer_id}</td>

<td>${n.regDate}</td>

<td>${n.hit}</td>

</tr>

</c:forEach>

<%-- <%} %> --%>

</tbody>

</table>

 

'기존카테고리 > JSP' 카테고리의 다른 글

filter  (0) 2020.04.24
ArrayList 형변환  (0) 2020.04.17
현재시간  (0) 2020.04.15
자바빈  (0) 2020.04.08
예외처리  (0) 2020.04.08