반응형
- <%@ 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" %>
- <html><head><title>Insert title here</title></head>
- <body>
- <center>
- ***상품자료***<br/>
- <sql:setDataSource var="ds" url="jdbc:oracle:thin:@localhost:1521:java"
- driver="oracle.jdbc.driver.OracleDriver"
- user="scott" password="tiger"/>
- <sql:query var="rs" dataSource="${ds}">
- select * from sangdata where code >= ? and code <= ?
- <sql:param value="${2}" />
- <sql:param value="${100}" />
- </sql:query>
- <table align="center" border="1">
- <tr>
- <th>코드</th><th>수량</th><th>단가</th><th>금액</th>
- </tr>
- <c:forEach var="r" items="${rs.rows}">
- <tr>
- <td><c:out value="${r.code}" /></td>
- <td><c:out value="${r.sang}" /></td>
- <td><c:out value="${r.su}" /></td>
- <td><c:out value="${r.dan}" /></td>
- <c:set var="tot" value="${r.su * r.dan}"></c:set>
- <td><c:out value="${tot}" /></td>
- </tr>
- </c:forEach>
- </table>
- </center></body>
- </html>