author | František Kučera <franta-hg@frantovo.cz> |
Sun, 21 Feb 2010 12:18:32 +0100 | |
changeset 35 | 93d3fab81ad4 |
parent 33 | 9f9840afa18f |
permissions | -rw-r--r-- |
franta-hg@33 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
franta-hg@33 | 2 |
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" |
franta-hg@33 | 3 |
xmlns:c="http://java.sun.com/jsp/jstl/core" |
franta-hg@33 | 4 |
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" |
franta-hg@33 | 5 |
version="2.0"> |
franta-hg@33 | 6 |
<jsp:directive.page contentType="application/xhtml+xml"/> |
franta-hg@33 | 7 |
<jsp:output doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" |
franta-hg@33 | 8 |
doctype-root-element="html" |
franta-hg@33 | 9 |
omit-xml-declaration="false"/> |
franta-hg@33 | 10 |
|
franta-hg@33 | 11 |
|
franta-hg@33 | 12 |
<!-- Aby fungovalo formátování čísel a dat při chybějící HTTP hlavičce --> |
franta-hg@33 | 13 |
<!-- Není potřeba, pokud ve web.xml nastavíme „fallbackLocale“ --> |
franta-hg@33 | 14 |
<c:if test="${header['Accept-language'] == null}"> |
franta-hg@33 | 15 |
<fmt:setLocale value="cs"/> |
franta-hg@33 | 16 |
</c:if> |
franta-hg@33 | 17 |
|
franta-hg@33 | 18 |
<!-- Jazyk požadovaný prohlížečem (Accept-language) půjde přebít GET parametrem --> |
franta-hg@33 | 19 |
<c:if test="${param.jazyk != null}"> |
franta-hg@33 | 20 |
<fmt:setLocale value="${param.jazyk}"/> |
franta-hg@33 | 21 |
<!-- Vyzkoušejte si: |
franta-hg@33 | 22 |
formatovani.jsp?jazyk=en_ |
franta-hg@33 | 23 |
formatovani.jsp?jazyk=_en |
franta-hg@33 | 24 |
formatovani.jsp?jazyk=_ |
franta-hg@33 | 25 |
--> |
franta-hg@33 | 26 |
</c:if> |
franta-hg@33 | 27 |
|
franta-hg@33 | 28 |
<fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/> |
franta-hg@33 | 29 |
|
franta-hg@33 | 30 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
franta-hg@33 | 31 |
<head> |
franta-hg@33 | 32 |
<title><fmt:message key="nazev"/></title> |
franta-hg@33 | 33 |
<link href="styl.css" type="text/css" rel="StyleSheet"/> |
franta-hg@33 | 34 |
</head> |
franta-hg@33 | 35 |
<body> |
franta-hg@33 | 36 |
|
franta-hg@33 | 37 |
|
franta-hg@33 | 38 |
<h1>Formátování</h1> |
franta-hg@33 | 39 |
|
franta-hg@33 | 40 |
<h2>Čísla</h2> |
franta-hg@33 | 41 |
<p>Formát čísla: ###,###.###</p> |
franta-hg@33 | 42 |
<p>1234567890 → <fmt:formatNumber value="1234567890" pattern="###,###.###"/></p> |
franta-hg@33 | 43 |
<p>1234567.890 → <fmt:formatNumber value="1234567.890" pattern="###,###.###"/></p> |
franta-hg@33 | 44 |
<p>1234567.123999 → <fmt:formatNumber value="1234567.123999" pattern="###,###.###"/></p> |
franta-hg@33 | 45 |
|
franta-hg@33 | 46 |
<h2>Datum</h2> |
franta-hg@33 | 47 |
<jsp:useBean id="datum" class="java.util.Date" scope="request"/> |
franta-hg@33 | 48 |
<p>dd.MM. yyyy HH:mm:ss → <fmt:formatDate value="${datum}" pattern="dd.MM. yyyy HH:mm:ss"/></p> |
franta-hg@33 | 49 |
<p>dd.MM. yyyy → <fmt:formatDate value="${datum}" pattern="dd.MM. yyyy"/></p> |
franta-hg@33 | 50 |
<p>dd.MMM yyyy → <fmt:formatDate value="${datum}" pattern="dd. MMM yyyy"/></p> |
franta-hg@33 | 51 |
<p>dd.MMMM yyyy → <fmt:formatDate value="${datum}" pattern="dd. MMMM yyyy"/></p> |
franta-hg@33 | 52 |
|
franta-hg@35 | 53 |
|
franta-hg@35 | 54 |
|
franta-hg@33 | 55 |
|
franta-hg@33 | 56 |
<h1>Lokalizace</h1> |
franta-hg@33 | 57 |
<p>K lokalizaci používáme značku &lt;fmt:message key="klic"/&gt;</p> |
franta-hg@33 | 58 |
<p>Zvolený jazyk: <fmt:message key="jazyk"/></p> |
franta-hg@33 | 59 |
|
franta-hg@33 | 60 |
<!-- lokalizovaný text si můžeme uložit do proměnné --> |
franta-hg@33 | 61 |
<fmt:message key="jazyk" var="xJazyk"/> |
franta-hg@33 | 62 |
|
franta-hg@33 | 63 |
<!-- a vypsat ho až později --> |
franta-hg@33 | 64 |
<p>Obsah proměnné: ${xJazyk}.</p> |
franta-hg@33 | 65 |
|
franta-hg@33 | 66 |
<pre><fmt:message key="odradkovani"/></pre> |
franta-hg@33 | 67 |
|
franta-hg@33 | 68 |
<p><fmt:message key="dlouhyRadek"/></p> |
franta-hg@33 | 69 |
|
franta-hg@35 | 70 |
<h2>Java si poradí i s českým jazykem</h2> |
franta-hg@35 | 71 |
<ul> |
franta-hg@35 | 72 |
<c:forEach var="pocet" begin="0" end="8"> |
franta-hg@35 | 73 |
<li><fmt:message key="pocetEmailu"><fmt:param value="${pocet}"/></fmt:message></li> |
franta-hg@35 | 74 |
</c:forEach> |
franta-hg@35 | 75 |
</ul> |
franta-hg@33 | 76 |
|
franta-hg@33 | 77 |
|
franta-hg@33 | 78 |
<jsp:include page="WEB-INF/casti/paticka.jsp"> |
franta-hg@33 | 79 |
<jsp:param name="rok" value="2010" /> |
franta-hg@33 | 80 |
</jsp:include> |
franta-hg@33 | 81 |
</body> |
franta-hg@33 | 82 |
</html> |
franta-hg@33 | 83 |
|
franta-hg@33 | 84 |
</jsp:root> |