franta-hg@12: <?xml version="1.0" encoding="UTF-8"?> franta-hg@12: <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" franta-hg@12: xmlns:c="http://java.sun.com/jsp/jstl/core" franta-hg@12: xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" franta-hg@12: xmlns:fn="http://java.sun.com/jsp/jstl/functions" franta-hg@12: version="2.0"> franta-hg@12: <jsp:directive.page contentType="application/xhtml+xml"/> franta-hg@12: <jsp:output doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" franta-hg@12: doctype-root-element="html" franta-hg@12: omit-xml-declaration="false"/> franta-hg@12: franta-hg@12: franta-hg@12: <html xmlns="http://www.w3.org/1999/xhtml"> franta-hg@12: <head> franta-hg@12: <title>Escapování</title> franta-hg@12: </head> franta-hg@12: <body> franta-hg@12: <h1>Escapování</h1> franta-hg@12: <h2>Vstup</h2> franta-hg@12: <!-- jednoduchý formulář na otestování uživatelského vstupu --> franta-hg@12: <form action="escapovani.jsp" method="post"> franta-hg@12: <fieldset> franta-hg@12: <input name="parametr1" type="text"/> franta-hg@12: <button>Odeslat!</button> franta-hg@12: </fieldset> franta-hg@12: </form> franta-hg@12: <h2>Výstup</h2> franta-hg@12: <!-- vypíšeme si parametr zadaný uživatelem, ale ošetříme ho, franta-hg@12: aby nám nezbořil naši pěknou XHTML stránku --> franta-hg@12: <p><c:out value="${param.parametr1}" escapeXml="true"/></p> franta-hg@12: <!-- escapeXml="true" nemusíme psát – to je výchozí hodnota --> franta-hg@12: franta-hg@12: <p>Když potřebujeme dát franta-hg@12: <abbr title="${fn:escapeXml(param.parametr1)}">„escapovaný“</abbr> franta-hg@12: text do atributu, použijeme funkci <code>escapeXml()</code> ze jmenného prostoru:</p> franta-hg@12: <pre>xmlns:fn="http://java.sun.com/jsp/jstl/functions"</pre> franta-hg@12: franta-hg@12: </body> franta-hg@12: </html> franta-hg@12: franta-hg@12: </jsp:root>