๊ตญ๋น์ง์ D+77
๊ณผ์ ํ๊ฐํ ์ ๋ณด์ฒ๋ฆฌ์ฐ์ ๊ธฐ์ฌ
- ํ์๋ชฉ๋ก์กฐํํ๋ฉด(inquiry.jsp) ๊ตฌํ -
ํ์๋ชฉ๋ก์กฐํํ๋ฉด(inquiry.jsp) ๊ตฌํ
ํ์๋ชฉ๋ก์กฐํํ๋ฉด์ ๊ฐ์ ์ผ์๊ฐ ๋ ์งํ์(YYYY-MM-DD)ํ์์ผ๋ก ๋์ค๊ฒ ํ๋ฉฐ, ๊ฐ ๋ฑ๊ธ์ ๋ํ ์๋ฏธ๋ฅผ ๋ด์ญ์ ๋ํ๋๋๋ก ํ๋ฉด ๋๋๋ฐ ResultSet์ ํตํด ๊ฐ์ ธ์จ ๋ฐ์ดํฐ๋ฅผ Switch๋ฌธ์ ํตํด ์ค์ ํด์ฃผ๋ฉด ๋๋ค.
• inquiry.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Date" %>
<%@ page import="DBPKG.DBConnection" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ํ์๋ชฉ๋ก์กฐํ/์์ </title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<header>
<div>
<h2>์ผํ๋ชฐ ํ์๊ด๋ฆฌ ver 1.0</h2>
</div>
</header>
<nav>
<div>
<a href="register.jsp">ํ์๋ฑ๋ก</a>
<a href="inquiry.jsp">ํ์๋ชฉ๋ก์กฐํ/์์ </a>
<a href="sale.jsp">ํ์๋งค์ถ์กฐํ</a>
<a href="index.jsp">ํ์ผ๋ก</a>
</div>
</nav>
<section>
<div>
<h3>ํ์๋ชฉ๋ก์กฐํ/์์ </h3>
<table border="1" style="width: 800px">
<tr>
<th>ํ์๋ฒํธ</th>
<th>ํ์์ฑ๋ช
</th>
<th>์ ํ๋ฒํธ</th>
<th>์ฃผ์</th>
<th>๊ฐ์
์ผ์</th>
<th>๊ณ ๊ฐ๋ฑ๊ธ</th>
<th>๊ฑฐ์ฃผ์ง์ญ</th>
</tr>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
String custno = "";
String custname = "";
String phone = "";
String address = "";
Date joindate = null;
String grade = "";
String city = "";
String sql = "select * from member_tbl_02 order by custno asc";
try
{
conn = DBConnection.getConnection();
stmt = conn.createStatement();
rset = stmt.executeQuery(sql);
while(rset.next())
{
custno = rset.getString("custno");
custname = rset.getString("custname");
phone = rset.getString("phone");
address = rset.getString("address");
joindate = rset.getDate("joindate");
grade = rset.getString("grade");
city = rset.getString("city");
switch(grade)
{
case "A":
grade = "VIP";
break;
case "B":
grade = "์ผ๋ฐ";
break;
case "C":
grade = "์ง์";
break;
default:
grade = "๋ฏธ์ ";
break;
}
%>
<tr>
<td><a href="modify.jsp?custno=<%= custno %>"><%= custno %></a></td>
<td><%= custname %></td>
<td><%= phone %></td>
<td><%= address %></td>
<td><%= joindate %></td>
<td><%= grade %></td>
<td><%= city %></td>
</tr>
<%
}
}
catch(Exception e)
{
System.out.println("[ERROR] " + e.getMessage());
e.printStackTrace();
}
%>
</table>
</div>
</section>
<footer>
<div>
<h4>HRDKOREA Copyright@2016 All rights reserved. Human Resources Development Service of Korea</h4>
</div>
</footer>
</body>
</html>
์ถํ์ ํ์๋ฒํธ๋ฅผ ๋๋ฅด๋ฉด ํด๋นํ์์ ์ ๋ณด๊ฐ ์์ ๋ ์ ์๊ฒ ์์ ํ์ด์ง๋ก ๋์ด๊ฐ ์ ์๋๋ก aํ๊ทธ๋ฅผ ์ฌ์ฉํด ์ค์ ํด์ฃผ์๋ค.
๋ฐ์ํ
๋๊ธ