java/nekurak.net-web/web/index.jsp
author František Kučera <franta-hg@frantovo.cz>
Thu, 11 Feb 2010 10:06:39 +0100
changeset 28 0f037986bb6b
parent 26 fc3e84d87e01
child 30 705871ca12e9
permissions -rw-r--r--
Hibernate.
franta-hg@3
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@10
     2
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
franta-hg@10
     3
	  xmlns:c="http://java.sun.com/jsp/jstl/core"
franta-hg@10
     4
	  version="2.0">
franta-hg@3
     5
    <jsp:directive.page contentType="application/xhtml+xml"/>
franta-hg@3
     6
    <jsp:output doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
franta-hg@3
     7
		doctype-root-element="html"
franta-hg@3
     8
		omit-xml-declaration="false"/>
franta-hg@3
     9
franta-hg@3
    10
    <html xmlns="http://www.w3.org/1999/xhtml">
franta-hg@3
    11
	<head>
franta-hg@3
    12
	    <title>Nekuřák.net</title>
franta-hg@26
    13
	    <link href="styl.css" type="text/css" rel="StyleSheet"/>
franta-hg@3
    14
	</head>
franta-hg@3
    15
	<body>
franta-hg@3
    16
	    <h1>Nekuřák.net</h1>
franta-hg@23
    17
	    <p>Načítáme údaje z databáze.</p>
franta-hg@8
    18
franta-hg@10
    19
franta-hg@10
    20
	    <!-- jednoduchá podmínka -->
franta-hg@10
    21
	    <c:if test="${param.akce == 'informace'}">
franta-hg@10
    22
		<p>Vypíšeme nějaké informace.</p>
franta-hg@10
    23
	    </c:if>
franta-hg@10
    24
franta-hg@10
    25
	    <!-- složitější větvení -->
franta-hg@10
    26
	    <c:choose>
franta-hg@10
    27
		<!-- if -->
franta-hg@10
    28
		<c:when test="${param.akce == 'seznam'}">
franta-hg@26
    29
		    <p>Vypíšeme seznam podniků:</p>
franta-hg@10
    30
		    <!-- Vytvoříme si instanci JavaBeany -->
franta-hg@14
    31
		    <jsp:useBean id="podnikyWeb" class="cz.frantovo.nekurak.web.PodnikyWeb" scope="request"/>
franta-hg@26
    32
		    <table>
franta-hg@26
    33
			<thead>
franta-hg@26
    34
			    <tr>
franta-hg@26
    35
				<td>Číslo</td>
franta-hg@26
    36
				<td>Název</td>
franta-hg@26
    37
			    </tr>
franta-hg@26
    38
			</thead>
franta-hg@26
    39
			<tbody>
franta-hg@26
    40
			    <c:forEach var="p" items="${podnikyWeb.podniky}">
franta-hg@26
    41
				<tr>
franta-hg@26
    42
				    <td><c:out value="${p.id}"/></td>
franta-hg@26
    43
				    <td><c:out value="${p.nazev}"/></td>
franta-hg@26
    44
				</tr>
franta-hg@26
    45
			    </c:forEach>
franta-hg@26
    46
			</tbody>
franta-hg@26
    47
		    </table>
franta-hg@10
    48
		</c:when>
franta-hg@10
    49
		<!-- else if -->
franta-hg@10
    50
		<c:when test="${param.akce == 'podrobnosti'}">
franta-hg@10
    51
		    <p>Vypíšeme podrobnosti.</p>
franta-hg@10
    52
		</c:when>
franta-hg@10
    53
		<!-- else -->
franta-hg@10
    54
		<c:otherwise>
franta-hg@10
    55
		    <p>Zobrazíme úvodní stránku.</p>
franta-hg@10
    56
		</c:otherwise>
franta-hg@10
    57
	    </c:choose>
franta-hg@10
    58
franta-hg@16
    59
	    <!-- vložíme si obsah jiného souboru.
franta-hg@16
    60
		 Obsah adresáře WEB-INF není přímo dostupný uživateli -->
franta-hg@8
    61
	    <jsp:include page="WEB-INF/casti/paticka.jsp">
franta-hg@8
    62
		<jsp:param name="rok" value="2010" />
franta-hg@8
    63
	    </jsp:include>
franta-hg@3
    64
	</body>
franta-hg@3
    65
    </html>
franta-hg@3
    66
franta-hg@3
    67
</jsp:root>