JSP SQL značky a schéma.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
3 xmlns:sql="http://java.sun.com/jsp/jstl/sql"
4 xmlns:c="http://java.sun.com/jsp/jstl/core"
6 <jsp:directive.page contentType="application/xhtml+xml"/>
7 <jsp:output doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
8 doctype-root-element="html"
9 omit-xml-declaration="false"/>
11 <html xmlns="http://www.w3.org/1999/xhtml">
13 <title>SQL značky</title>
19 <!-- nastavíme výchozí datový zdroj -->
20 <sql:setDataSource dataSource="jdbc/nekurak"/>
22 <!-- Jednoduchý dotaz -->
23 <pre>SELECT * FROM podnik;</pre>
24 <sql:query var="podniky">SELECT * FROM podnik;</sql:query>
26 <c:forEach items="${podniky.rowsByIndex}" var="p">
27 <li><c:out value="${p[1]}"/></li>
31 <!-- Parametrizovaný dotaz -->
32 <pre>SELECT * FROM podnik WHERE nazev = ?;</pre>
33 <sql:query var="podniky" sql="SELECT * FROM podnik WHERE nazev = ?;">
34 <sql:param value="Na Kovárně"/>
37 <c:forEach items="${podniky.rowsByIndex}" var="p">
38 <li><c:out value="${p[1]}"/></li>