๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
์‹œ๋„/๊ตญ๋น„์ง€์›

[D+77] ๊ณผ์ •ํ‰๊ฐ€ํ˜• ์ •๋ณด์ฒ˜๋ฆฌ์‚ฐ์—…๊ธฐ์‚ฌ : ํšŒ์›๋ชฉ๋ก์กฐํšŒํ™”๋ฉด(inquiry.jsp) ๊ตฌํ˜„

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2023. 1. 9.

 

 

๊ตญ๋น„์ง€์› 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ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•ด ์„ค์ •ํ•ด์ฃผ์—ˆ๋‹ค.

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€