java/nekurak.net-web/web/index.jsp
author František Kučera <franta-hg@frantovo.cz>
Fri, 08 Jan 2010 21:23:42 +0100
changeset 14 0043a3b32d31
parent 10 2c9c0de3ae64
child 16 50e275fcc2e3
permissions -rw-r--r--
Drobný refaktoring.
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@3
    13
	</head>
franta-hg@3
    14
	<body>
franta-hg@3
    15
	    <h1>Nekuřák.net</h1>
franta-hg@3
    16
	    <p>Začínáme s J2EE…</p>
franta-hg@8
    17
franta-hg@10
    18
franta-hg@10
    19
	    <!-- jednoduchá podmínka -->
franta-hg@10
    20
	    <c:if test="${param.akce == 'informace'}">
franta-hg@10
    21
		<p>Vypíšeme nějaké informace.</p>
franta-hg@10
    22
	    </c:if>
franta-hg@10
    23
franta-hg@10
    24
	    <!-- složitější větvení -->
franta-hg@10
    25
	    <c:choose>
franta-hg@10
    26
		<!-- if -->
franta-hg@10
    27
		<c:when test="${param.akce == 'seznam'}">
franta-hg@10
    28
		    <p>Vypíšeme seznam hospod.</p>
franta-hg@10
    29
		    <!-- Vytvoříme si instanci JavaBeany -->
franta-hg@14
    30
		    <jsp:useBean id="podnikyWeb" class="cz.frantovo.nekurak.web.PodnikyWeb" scope="request"/>
franta-hg@10
    31
		    <ul>
franta-hg@14
    32
			<c:forEach var="p" items="${podnikyWeb.podniky}">
franta-hg@10
    33
			    <!-- vypíšeme název podniku (měli bychom escapovat) -->
franta-hg@10
    34
			    <li>${p.nazev}</li>
franta-hg@10
    35
			</c:forEach>
franta-hg@10
    36
		    </ul>
franta-hg@10
    37
		</c:when>
franta-hg@10
    38
		<!-- else if -->
franta-hg@10
    39
		<c:when test="${param.akce == 'podrobnosti'}">
franta-hg@10
    40
		    <p>Vypíšeme podrobnosti.</p>
franta-hg@10
    41
		</c:when>
franta-hg@10
    42
		<!-- else -->
franta-hg@10
    43
		<c:otherwise>
franta-hg@10
    44
		    <p>Zobrazíme úvodní stránku.</p>
franta-hg@10
    45
		</c:otherwise>
franta-hg@10
    46
	    </c:choose>
franta-hg@10
    47
franta-hg@10
    48
franta-hg@8
    49
	    <!-- vložíme si obsah jiného souboru
franta-hg@8
    50
		 obsah WEB-INF není přímo dostupný uživateli -->
franta-hg@8
    51
	    <jsp:include page="WEB-INF/casti/paticka.jsp">
franta-hg@8
    52
		<jsp:param name="rok" value="2010" />
franta-hg@8
    53
	    </jsp:include>
franta-hg@3
    54
	</body>
franta-hg@3
    55
    </html>
franta-hg@3
    56
franta-hg@3
    57
</jsp:root>