ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

728x90
SMALL
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>   
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
 <fmt:requestEncoding value="euc-kr" />
 
 <h2>SQL ํƒœ๊ทธ์—ฐ์Šต</h2>
 <div>์ด๋ฆ„์€ ${param.name }</div>
 <fieldset>
  <legend>์ด๋ฆ„๋„ฃ๊ธฐ</legend>
  <form method="post" action="">
   Name : <input type="text" name="name" />
   <input type="submit" value="๊ฐ€์ž" />
  </form>
 </fieldset>
 
 <c:catch var="msg"><!-- ์˜ˆ์™ธ์ฒ˜๋ฆฌ์šฉ -->
  <!-- Connection ์„ค์ • -->
  <sql:setDataSource
   driver="oracle.jdbc.OracleDriver"
   user="user01"
   password="user01"
   url="jdbc:oracle:thin:@211.241.228.11:1521:orcl"
   var="con"
  />
 
  <!-- ๋ฐ์ดํ„ฐ์ž…๋ ฅ -->
  <c:set var="name" value="${param.name}"/>
  <sql:update dataSource="${con}">
   insert into test2 values (test2_seq.nextval,?)
   <sql:param value="${name }"></sql:param>
  </sql:update>
 
  <!-- ๋ฐ์ดํ„ฐ์กฐํšŒ -->
  <sql:query var="rs" dataSource="${con}">
   select * from test2
  </sql:query>
 
  <!-- ๊บผ๋‚ด์ž -->
  <c:forEach items="${rs.rows}" var="row">
   ${row['num']}, ${row['name']}<br/>
  </c:forEach>
 </c:catch>
 
 <c:if test="${msg != null}">
  ${msg.message}
 </c:if>
</body>
</html>
728x90
LIST
๋Œ“๊ธ€
it,์Šˆ2008/2/14 Start...
๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
ยซ   2025/04   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
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
๊ธ€ ๋ณด๊ด€ํ•จ
250x250