Notice
Recent Posts
Recent Comments
Link
«   2024/06   »
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
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

view_one 본문

JSP/DB (3)

view_one

GAWON 2023. 6. 1. 09:21
<%@page import="java.util.List"%>
<%@page import="org.joonzis.ex.GreenDto"%>
<%@page import="org.joonzis.ex.GreenDao"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>   
   <%
      	request.setCharacterEncoding("utf-8");
            String id = request.getParameter("id");  
            // 파란색 id는 아이디 입력창에서 내가 직접 id 값을 입력한 것, String id는 이 페이지에서 사용하기 위한 변수를 선언을 한 것 
            
            
            // Ctrl + 메소드 클릭 : 메소드 구현한 파일(위치)로 이동
            // GreenDao.getInstance() : 객체
            
           	GreenDto dto = GreenDao.getInstance().getSelectOne(id);	
            // 위에서 선언한 id를 데이터 1개 출력하기 위한 함수인 getSelectOne() 함수에다가 매개변수로 넘겨줌(값 전달해줌)
         
            pageContext.setAttribute("dto", dto);
      %>
   <jsp:include page="index.jsp"/>

   <br>
   <hr>
   <br>

   <h1>${dto.getId() }회원의 데이터</h1>
   <table>
      <thead>
         <tr>
            <th>회원 번호</th>
            <th>아이디</th>
            <th>비밀번호</th>
            <th>이름</th>
            <th>나이</th>
            <th>주소</th>
            <th>가입일</th>
         </tr>
      </thead>
      <tbody>
         <c:choose>
            <c:when test="${empty dto }">
               <tr>
                  <td colspan="7"><%=id%>회원 정보가 없습니다.</td>
               </tr>
            </c:when>
            <c:otherwise>
               <tr>
                  <td>${dto.getIdx() }</td>
                  <td>${dto.id }</td>
                  <td>${dto.pw }</td>
                  <td>${dto.name }</td>
                  <td>${dto.age }</td>
                  <td>${dto.addr }</td>
                  <td>${dto.reg_date }</td>
               </tr>
            </c:otherwise>
         </c:choose>
      </tbody>
   </table>
</body>
</html>

'JSP > DB (3)' 카테고리의 다른 글

view_all  (0) 2023.06.01
Update_page  (0) 2023.06.01
Update  (0) 2023.06.01
Remove  (0) 2023.06.01
Insert  (0) 2023.06.01