admin.member/List2.java
페이지 정보
작성자 관리자 작성일 23-04-01 18:24 조회 387 댓글 0본문
package admin.member;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dao.AdminMemberDAO;
import model.Member;
@WebServlet("/admin/member2/list")
public class List2 extends HttpServlet {
private static final long serialVersionUID = 1L;
public List2() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//한 페이지당 출력 게시물 수
int pageSize = 5;
//현재 페이지
int pageNum = 1;
if(request.getParameter("pageNum") != null) {
pageNum = Integer.parseInt(request.getParameter("pageNum"));
}
//검색어
String field = request.getParameter("field");
String search = request.getParameter("search");
AdminMemberDAO dao = new AdminMemberDAO();
//전체 게시글 수
int count = dao.getAllcount(field, search);
//넘버링
int number = count - (pageNum - 1) * pageSize;
//현재 보여질 페이지 limit 값 설정
int startRow = (pageNum - 1) * pageSize;
int endRow = pageSize;
ArrayList<Member> v = dao.getAllMember(startRow, endRow, field, search);
request.setAttribute("v", v);
request.setAttribute("number", number);
request.setAttribute("pageSize", pageSize);
request.setAttribute("count", count);
request.setAttribute("pageNum", pageNum);
request.setAttribute("field", field);
request.setAttribute("search", search);
RequestDispatcher dis = request.getRequestDispatcher("list.jsp");
dis.forward(request, response);
}
}
댓글목록 0
등록된 댓글이 없습니다.