request.setAttribute("title", rs.getString("title"));
request.setAttribute("writerId", rs.getString("writerId"));
.
.
.
request.setAttribute("hit", rs.getString("hit"));
package com.newlecture.web.entity;
import java.sql.Date;
public class Notice {
private int id;
private String title;
private String wirtedId;
private Date regdate;
private String hit;
private String files;
private String content;
public Notice() {
// TODO Auto-generated constructor stub
}
public Notice(int id, String title, String wirtedId, Date regdate, String hit, String files, String content) {
this.id = id;
this.title = title;
this.wirtedId = wirtedId;
this.regdate = regdate;
this.hit = hit;
this.files = files;
this.content = content;
}
.
.
.
"자바의 반복문을 이용한 제어구조에서 태그를 이용한 제어구조로"
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
위의 코드를 해당 .jsp 파일 윗단에 작성한다.
forEach 태그를 통해 반복을 할 수 있다.
<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.writerId }</td>
<td>${n.regdate }</td>
<td>${n.hit }</td>
</tr>
</c:forEach>