<%@ page import = "java.sql.*" contentType = "text/html;charset=EUC-KR"%>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:xe";
Connection dbconn = DriverManager.getConnection(url, "c##madang", "c##madang");
Statement stmt = dbconn.createStatement();
ResultSet myResultSet = stmt.executeQuery("SELECT * FROM Book");
%>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>** BOOK LIST**</title>
</head>

<body bgcolor = "white" text = "black" link = "blue" vlink = "purple" alink = "red">
<table border = "1" cellspacing = "0" width = "400" bordercolor = "#9AD2F7"
			bordercolordark = "white" bordercolorlight = "#B9E0FA">
		<tr> 
			<td width = "150" height = "20" bgcolor = "#D2E9F9">
			<p align = "center">
			<span style = "font-size : 8pt;"><b>BOOKNAME</b></span></p>
			</td>
			<td width = "150" height = "20" bgcolor = "#D2E9F9">
			<p align = "center">
			<span style = "font-size : 8pt;"><b>PUBLISHER</b></span></p>
			</td>
			<td width = "50" height = "20" bgcolor = "#D2E9F9">
			<p align = "center">
			<span style = "font-size : 8pt;"><b>PRICE</b></span></p>
			</td>
		</tr>
<%
if(myResultSet != null) {
	while(myResultSet.next()){
		String W_BOOKID = myResultSet.getString("bookid");
		String W_BOOKNAME = myResultSet.getString("bookname");
		String W_PUBLISHER = myResultSet.getString("publisher");
		String W_PRICE = myResultSet.getString("price");
%>
	<tr>
		<td width = "150" height = "20">
			<p><span style = "font-size : 9pt;">
			<a href="bookview.jsp?bookid=<%=W_BOOKID%>">
			<font face = "돋움체" color = "black">
			<%=W_BOOKNAME%></font></a></span></p>
		</td>
		<td width = "150" height = "20">
			<p align = "center"><span style = "font-size : 9pt;">
			<font face = "돋움체"><%=W_PUBLISHER%></font></span></p>
		</td>
		
		<td width = "50" height = "20">
			<p align = "center"><span style = "font-size : 9pt;">
			<font face = "돋움체"><%=W_PRICE%></font></span></p>
		</td>
	</tr>
<%
		}
	}
	stmt.close();
	dbconn.close();
%>
</table>
<table cellpadding = "0" cellspacing = "0" width = "400" height = "23">
	<tr>
		<td width = "1350">
			<p align = "right"><b>
			<font size = "1" face = "돋움체" color = "black">LIST</b></p>
		</td>
	</tr>
</table>
</body>
</html>

 

<%@ page import="java.sql.*" contentType="text/html; charset=EUC_KR" %>
<%
	Class.forName("oracle.jdbc.driver.OracleDriver");
	String url = "jdbc:oracle:thin:@localhost:1521:xe";
	Connection dbConn = DriverManager.getConnection(url, "c##madang", "c##madang");
	Statement stmt = dbConn.createStatement();
	String bookid = request.getParameter("bookid");
	ResultSet myResultSet = stmt.executeQuery("SELECT * FROM book WHERE bookid=" +bookid);
	if(myResultSet != null){
		myResultSet.next();
%>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title> ** Book VIEW **</title>
</head>


<body bgcolor = "white" text = "black" link = "blue" vlink = "purple" alink = "red">
<table border = "1" cellspacing = "0" width = "400" bordercolor = "#9AD2F7"
			bordercolordark = "white" bordercolorlight = "#B9E0FA">
			
			<tr>
				<td width="150" height="23">
					<p align="center">
					<span style="font-size: 9pt;">책 제 목</span></p>
				</td>
				<td width="513">
					<p><span style="font-size: 9pt;">
					<%=myResultSet.getString("BOOKNAME")%></span></p>
				</td>
			</tr>
			<tr>
				<td width="150" height="23">
					<p align="center">
					<span style="font-size: 9pt;">출 판 사</span></p>
				</td>
				<td width="513">
					<p><span style="font-size: 9pt;">
					<%=myResultSet.getString("PUBLISHER")%></span></p>
				</td>
			</tr>
			<tr>
				<td width="150" height="23">
					<p align="center">
					<span style="font-size: 9pt;">가 격</span></p>
				</td>
				<td width="513">
					<p><span style="font-size: 9pt;">
					<%=myResultSet.getString("PRICE")%></span></p>
				</td>
			</tr>
</table>
<table cellpadding="0" cellspacing="0" width = "400" height="23">
	<tr>
		<td width="150">
			<p align="right"><span style="font-size: 9pt">
			<a href="booklist.jsp?">
			<font color="black">목록</font></a></span></p>
		</td>
	</tr>
</table>
<% 
	}
	stmt.close();
	dbConn.close();
%>
</body>

</html>

 

'Web > Jsp' 카테고리의 다른 글

자바스크립트의 역할  (1) 2020.05.19
QueryBean  (0) 2020.05.19
out.print  (0) 2020.05.19
이클립스에 톰캣 설치하기  (0) 2020.04.23
회원가입 예제1  (0) 2020.03.05

+ Recent posts