jsp에서 out.print는 웹페이지 출력을 의미한다(?)

 

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

자바스크립트의 역할  (1) 2020.05.19
QueryBean  (0) 2020.05.19
데이터베이스의 자료를 Jsp를 이용하여 출력하기  (0) 2020.04.23
이클립스에 톰캣 설치하기  (0) 2020.04.23
회원가입 예제1  (0) 2020.03.05
<%@ 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

------------------------

PHP, JSP 가 보이면 서버라고 보면 된다

JSP장점
자바와 같이 쓸 수 있다(기능을 다양하게 쓸 수 있다)

JSP는 Java코드에 +@JSP코드 + HTML코드 로 구성된다

다이나믹 웹 프로젝트

아파치 톰캣 (지금은 이클립스 안에서 돌아가도록 실습)

이클립스 엔터프라이즈나 STS툴을 써야한다

관리자권한으로 실행

 

 

 

 

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

자바스크립트의 역할  (1) 2020.05.19
QueryBean  (0) 2020.05.19
out.print  (0) 2020.05.19
데이터베이스의 자료를 Jsp를 이용하여 출력하기  (0) 2020.04.23
회원가입 예제1  (0) 2020.03.05

See the Pen MWwVRRY by jaybon (@jaybon1) on CodePen.

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

부트스트랩 div 세로 가운데 정렬  (0) 2020.06.10
input button type 버튼 타입  (0) 2020.06.02
자바스크립트 없이 onmouse효과주기  (0) 2020.03.12
onclick으로 페이지 내용 바꾸기  (0) 2020.03.12
form 꾸미기  (0) 2020.03.06

See the Pen zYGWNxJ by jaybon (@jaybon1) on CodePen.

See the Pen poJLRvd by jaybon (@jaybon1) on CodePen.

See the Pen BaNrpyL by jaybon (@jaybon1) on CodePen.

See the Pen dyompPO by jaybon (@jaybon1) on CodePen.

+ Recent posts