This file is indexed.

/usr/share/doc/racket/web-server/faq.html is in racket-doc 6.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>10&nbsp;Troubleshooting and Tips</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Web Applications in Racket</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="run.html" class="tocviewlink" data-pltdoc="x">Running Web Servlets</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="servlet.html" class="tocviewlink" data-pltdoc="x">Stateful Servlets</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="stateless.html" class="tocviewlink" data-pltdoc="x">Stateless Servlets</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="http.html" class="tocviewlink" data-pltdoc="x">HTTP:<span class="mywbr"> &nbsp;</span> Hypertext Transfer Protocol</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="dispatch.html" class="tocviewlink" data-pltdoc="x">URL-<wbr></wbr>Based Dispatch</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="formlets.html" class="tocviewlink" data-pltdoc="x">Formlets:<span class="mywbr"> &nbsp;</span> Functional Form Abstraction</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="templates.html" class="tocviewlink" data-pltdoc="x">Templates:<span class="mywbr"> &nbsp;</span> Separation of View</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="page.html" class="tocviewlink" data-pltdoc="x">Page:<span class="mywbr"> &nbsp;</span> Short-<wbr></wbr>hand for Common Patterns</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="test.html" class="tocviewlink" data-pltdoc="x">Testing Servlets</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9658;</a></td><td>10&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">10.1&nbsp;</td><td><a href="#%28part._.Why_is_my_servlet_failing_with_a_can-be-response__contract_violation_after_updating_.Racket_%29" class="tocviewlink" data-pltdoc="x">Why is my servlet failing with a <span class="RktSym">can-<wbr></wbr>be-<wbr></wbr>response?</span> contract violation after updating Racket?</a></td></tr><tr><td align="right">10.2&nbsp;</td><td><a href="#%28part._.Why_are_my_templates_not_updating_on_the_server_when_.I_change_the_file_on_disk_%29" class="tocviewlink" data-pltdoc="x">Why are my templates not updating on the server when I change the file on disk?</a></td></tr><tr><td align="right">10.3&nbsp;</td><td><a href="#%28part._.Why_are_templates_compiled_into_programs_%29" class="tocviewlink" data-pltdoc="x">Why are templates compiled into programs?</a></td></tr><tr><td align="right">10.4&nbsp;</td><td><a href="#%28part._update-servlets%29" class="tocviewlink" data-pltdoc="x">Why are my stateful servlets not updating on the server when I change the file on disk?</a></td></tr><tr><td align="right">10.5&nbsp;</td><td><a href="#%28part._refresh-servlets%29" class="tocviewlink" data-pltdoc="x">After refreshing my stateful servlet, old captured continuations don&rsquo;t change or old global effects are gone. Why?</a></td></tr><tr><td align="right">10.6&nbsp;</td><td><a href="#%28part._.How_are_stateless_servlets_different_from_stateful_servlets_vis_a_vis_refreshing_%29" class="tocviewlink" data-pltdoc="x">How are stateless servlets different from stateful servlets vis a vis refreshing?</a></td></tr><tr><td align="right">10.7&nbsp;</td><td><a href="#%28part._.What_special_considerations_are_there_for_security_with_the_.Web_.Server_%29" class="tocviewlink" data-pltdoc="x">What special considerations are there for security with the Web Server?</a></td></tr><tr><td align="right">10.8&nbsp;</td><td><a href="#%28part._.My_browser_displays_my_page_strangely__my_.C.S.S_is_ignored__sections_are_missing__etc_%29" class="tocviewlink" data-pltdoc="x">My browser displays my page strangely:<span class="mywbr"> &nbsp;</span> my CSS is ignored, sections are missing, etc.</a></td></tr><tr><td align="right">10.9&nbsp;</td><td><a href="#%28part._.How_do_.I_use_templates__dynamically__%29" class="tocviewlink" data-pltdoc="x">How do I use templates &ldquo;dynamically"?</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">10.1<tt>&nbsp;</tt></span><a href="#%28part._.Why_is_my_servlet_failing_with_a_can-be-response__contract_violation_after_updating_.Racket_%29" class="tocsubseclink" data-pltdoc="x">Why is my servlet failing with a <span class="RktSym">can-<wbr></wbr>be-<wbr></wbr>response?</span> contract violation after updating Racket?</a></td></tr><tr><td><span class="tocsublinknumber">10.2<tt>&nbsp;</tt></span><a href="#%28part._.Why_are_my_templates_not_updating_on_the_server_when_.I_change_the_file_on_disk_%29" class="tocsubseclink" data-pltdoc="x">Why are my templates not updating on the server when I change the file on disk?</a></td></tr><tr><td><span class="tocsublinknumber">10.3<tt>&nbsp;</tt></span><a href="#%28part._.Why_are_templates_compiled_into_programs_%29" class="tocsubseclink" data-pltdoc="x">Why are templates compiled into programs?</a></td></tr><tr><td><span class="tocsublinknumber">10.4<tt>&nbsp;</tt></span><a href="#%28part._update-servlets%29" class="tocsubseclink" data-pltdoc="x">Why are my stateful servlets not updating on the server when I change the file on disk?</a></td></tr><tr><td><span class="tocsublinknumber">10.5<tt>&nbsp;</tt></span><a href="#%28part._refresh-servlets%29" class="tocsubseclink" data-pltdoc="x">After refreshing my stateful servlet, old captured continuations don&rsquo;t change or old global effects are gone. Why?</a></td></tr><tr><td><span class="tocsublinknumber">10.6<tt>&nbsp;</tt></span><a href="#%28part._.How_are_stateless_servlets_different_from_stateful_servlets_vis_a_vis_refreshing_%29" class="tocsubseclink" data-pltdoc="x">How are stateless servlets different from stateful servlets vis a vis refreshing?</a></td></tr><tr><td><span class="tocsublinknumber">10.7<tt>&nbsp;</tt></span><a href="#%28part._.What_special_considerations_are_there_for_security_with_the_.Web_.Server_%29" class="tocsubseclink" data-pltdoc="x">What special considerations are there for security with the Web Server?</a></td></tr><tr><td><span class="tocsublinknumber">10.8<tt>&nbsp;</tt></span><a href="#%28part._.My_browser_displays_my_page_strangely__my_.C.S.S_is_ignored__sections_are_missing__etc_%29" class="tocsubseclink" data-pltdoc="x">My browser displays my page strangely:<span class="mywbr"> &nbsp;</span> my CSS is ignored, sections are missing, etc.</a></td></tr><tr><td><span class="tocsublinknumber">10.9<tt>&nbsp;</tt></span><a href="#%28part._.How_do_.I_use_templates__dynamically__%29" class="tocsubseclink" data-pltdoc="x">How do I use templates &ldquo;dynamically"?</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="test.html" title="backward to &quot;9 Testing Servlets&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Web Applications in Racket&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="doc-index.html" title="forward to &quot;Index&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;faq&quot;">10<tt>&nbsp;</tt><a name="(part._faq)"></a>Troubleshooting and Tips</h3><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;Why_is_my_servlet_failing_with_a_can-be-response__contract_violation_after_updating_Racket_&quot;">10.1<tt>&nbsp;</tt><a name="(part._.Why_is_my_servlet_failing_with_a_can-be-response__contract_violation_after_updating_.Racket_)"></a>Why is my servlet failing with a <span class="RktSym">can-be-response?</span> contract violation after updating Racket?</h4><p>After 5.0.2, the Web Server had a backwards incompatible change that prevents X-expressions and lists of bytes from being directly returned from servlets. Please read <span class="stt">"PLTHOME/collects/web-server/compat/0/README"</span> to learn about porting your servlets forward. Don&rsquo;t worry. It&rsquo;s easy.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;Why_are_my_templates_not_updating_on_the_server_when_I_change_the_file_on_disk_&quot;">10.2<tt>&nbsp;</tt><a name="(part._.Why_are_my_templates_not_updating_on_the_server_when_.I_change_the_file_on_disk_)"></a>Why are my templates not updating on the server when I change the file on disk?</h4><p>Templates are compiled into your application, so when you change them there is no connection between that change in the filesystem and the compiled bytecode that is already loaded in a running Web server process. For more discussion, see <a href="#%28part._update-servlets%29" data-pltdoc="x">Why are my stateful servlets not updating on the server when I change the file on disk?</a>.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;Why_are_templates_compiled_into_programs_&quot;">10.3<tt>&nbsp;</tt><a name="(part._.Why_are_templates_compiled_into_programs_)"></a>Why are templates compiled into programs?</h4><p>Since templates can include arbitrary Racket code, macros, etc and refer to
arbitrary identifiers, <span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span> is really just an obscured
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span>.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;update-servlets&quot;">10.4<tt>&nbsp;</tt><a name="(part._update-servlets)"></a>Why are my stateful servlets not updating on the server when I change the file on disk?</h4><p>If you are using <span class="RktSym"><a href="run.html#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">serve/servlet</a></span>, it starts a Web server that directly references a closure that has no connection
to some file on the disk.</p><p>If you are using the command-line tool, or configuration file, then by default,
the server uses <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server-internal&amp;rel=dispatch-servlets.html%23%2528def._%2528%2528lib._web-server%252Fdispatchers%252Fdispatch-servlets..rkt%2529._make-cached-url-%7E3eservlet%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">make-cached-url-&gt;servlet</a></span> to load servlets
from the disk. As it loads them, they are cached and the disk is not referred to for future
requests. This ensures that there is a single namespace for each servlet, so that different instances
can share resources, such as database connections, and communicate through the store. The default
configuration of the server (meaning the dispatcher sequence used when you load a configuration file)
provides a special URL to localhost that will reset the cache: <span class="stt">"/conf/refresh-servlets"</span>.</p><p>If you want the server to reload your changed servlet code, then GET this URL and the server will reload the
servlet on the next request. However, you may be surprised by what happens on the next request. For more discussion, see <a href="#%28part._refresh-servlets%29" data-pltdoc="x">After refreshing my stateful servlet, old captured continuations don&rsquo;t change or old global effects are gone. Why?</a>.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;refresh-servlets&quot;">10.5<tt>&nbsp;</tt><a name="(part._refresh-servlets)"></a>After refreshing my stateful servlet, old captured continuations don&rsquo;t change or old global effects are gone. Why?</h4><p>Every load of your servlet is in a fresh namespace. When you refresh, a new namespace without the old effects is created. Old captured continuations
refer to the original namespace and will never update. It is impossible, in general, to port a continuation from one namespace to another, because the
code could be arbitrarily different.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;How_are_stateless_servlets_different_from_stateful_servlets_vis_a_vis_refreshing_&quot;">10.6<tt>&nbsp;</tt><a name="(part._.How_are_stateless_servlets_different_from_stateful_servlets_vis_a_vis_refreshing_)"></a>How are stateless servlets different from stateful servlets vis a vis refreshing?</h4><p>Continuations are serialized with a hash that ensures that any source
code modifications makes all the old continuations incompatible for
the same reason native continuations naturally are.</p><p>However, this hash only protects against changes in a single source file. Therefore if you modularize
your application, then only continuations that refer to changed source files will be incompatible.
For example, if you put all your templates in a single module, then it can change without
invalidating old continuations.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;What_special_considerations_are_there_for_security_with_the_Web_Server_&quot;">10.7<tt>&nbsp;</tt><a name="(part._.What_special_considerations_are_there_for_security_with_the_.Web_.Server_)"></a>What special considerations are there for security with the Web Server?</h4><p>The biggest problem is that a naive usage of continuations will allow continuations to subvert
authentication mechanisms. Typically, all that is necessary to execute a continuation is its URL.
Thus, URLs must be as protected as the information in the continuation.</p><p>Consider if you link to a public site from a private continuation URL: the <span class="stt">Referrer</span> field in
the new HTTP request will contain the private URL. Furthermore, if your HTTP traffic is in the clear,
then these URLs can be easily poached.</p><p>One solution to this is to use a special cookie as an authenticator. This way, if a URL escapes, it will
not be able to be used, unless the cookie is present. For advice about how to do this well, see
<a href="http://cookies.lcs.mit.edu/pubs/webauth.html">Dos and Don&rsquo;ts of Client Authentication on the Web</a>
from the MIT Cookie Eaters.</p><p>Note: It may be considered a great feature that URLs can be shared this way, because delegation is
easily built into an application via URLs.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;My_browser_displays_my_page_strangely__my_CSS_is_ignored__sections_are_missing__etc_&quot;">10.8<tt>&nbsp;</tt><a name="(part._.My_browser_displays_my_page_strangely__my_.C.S.S_is_ignored__sections_are_missing__etc_)"></a>My browser displays my page strangely: my CSS is ignored, sections are missing, etc.</h4><p>Most Web Server developers use <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528tech._x._expression%2529&amp;version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">X-expression</span></a>s for representing the
HTML of their page. However, <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528tech._x._expression%2529&amp;version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">X-expression</span></a>s only represent XML and HTML is not exactly
XML. This is a common source of problems.</p><p>For example, XML allows the "empty tag shorthand", e.g. <span class="RktInBG"><span class="hspace"></span><span class="RktIn">&lt;img src='...' /&gt;</span><span class="hspace"></span></span>, on every tag, while HTML occasionally requires an end
tag,
e.g. <a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.7">TEXTAREA</a>.
Similarly, XML allows an end tag, e.g. <span class="RktInBG"><span class="hspace"></span><span class="RktIn">&lt;img src='...'&gt;&lt;/img&gt;</span><span class="hspace"></span></span>, on every tag, while HTML occasionally forbides an
end tag,
e.g. <a href="http://www.w3.org/TR/html401/struct/objects.html#h-13.2">IMG</a>.
(Of course, browsers do not necessarily implement their HTML parsing
as specified and may be more or less lenient towards XML-like HTML, so
your test browser may not treat these forms as problematic.)</p><p>Since the Web Server uses <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html&amp;version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">xml</span></a> to format <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528tech._x._expression%2529&amp;version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">X-expression</span></a>s, it
inherits <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html&amp;version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">xml</span></a>&rsquo;s default rendering behavior in general
and its use of "empty tag shorthand" in
particular. <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html&amp;version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">xml</span></a>&rsquo;s default is always use the shorthand
with the tags from <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528def._%2528%2528lib._xml%252Fmain..rkt%2529._html-empty-tags%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">html-empty-tags</a></span> and never otherwise. This
list should contain the W3C&rsquo;s approved list. You can change it with
the <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528def._%2528%2528lib._xml%252Fmain..rkt%2529._empty-tag-shorthand%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">empty-tag-shorthand</a></span> parameter.</p><p>You can also change your <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528tech._x._expression%2529&amp;version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">X-expression</span></a> so that an end tag is forced. For
example, <span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">textarea</span><span class="stt"> </span><span class="RktVal">[</span><span class="RktVal">(</span><span class="RktVal">name</span><span class="stt"> </span><span class="RktVal">"text"</span><span class="RktVal">)</span><span class="RktVal">]</span><span class="RktVal">)</span> renders as
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">&lt;textarea name="text" /&gt;</span><span class="hspace"></span></span>, while <span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">textarea</span><span class="stt"> </span><span class="RktVal">[</span><span class="RktVal">(</span><span class="RktVal">name</span><span class="stt"> </span><span class="RktVal">"text"</span><span class="RktVal">)</span><span class="RktVal">]</span><span class="stt"> </span><span class="RktVal">""</span><span class="RktVal">)</span> renders as <span class="RktInBG"><span class="hspace"></span><span class="RktIn">&lt;textarea name="text"&gt;&lt;/textarea&gt;</span><span class="hspace"></span></span>,
because of the string content in the <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528tech._x._expression%2529&amp;version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">X-expression</span></a>. In this case, the end
tag will always be present regardless of the value of
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&amp;rel=index.html%23%2528def._%2528%2528lib._xml%252Fmain..rkt%2529._empty-tag-shorthand%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">empty-tag-shorthand</a></span>. It is not possible to force the other
possibility; i.e., never include an end tag.</p><p>You may think the Web Server could do a better job advertising that
the contents it serves is more like XML by default. Unfortunately,
browser support for such
<a href="http://www.w3.org/TR/xhtml-media-types/#media-types">advertisement</a>
is <a href="http://www.w3.org/MarkUp/2004/xhtml-faq#ie">lacking</a>.  You
can use <span class="RktSym"><a href="http.html#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span> to easily customize your
application&rsquo;s MIME type and response headers.</p><p>Finally, you may find Web browser inspectors such as the Safari
Inspector, Firebug, and the Google Chrome error console to be useful
tools in identifying offending tags.</p><h4 x-source-module="(lib &quot;web-server/scribblings/web-server.scrbl&quot;)" x-part-tag="&quot;How_do_I_use_templates__dynamically__&quot;">10.9<tt>&nbsp;</tt><a name="(part._.How_do_.I_use_templates__dynamically__)"></a>How do I use templates &ldquo;dynamically"?</h4><p><div class="SIntrapara">A common feature request is to include one template in another dynamically. It should hopefully be obvious that <span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span> can be included in a template to include a <span style="font-style: italic">static</span> sub-template. For example,
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"posts.html"</span><span class="RktPn">)</span></p></blockquote></div><div class="SIntrapara">may appear inside the <span class="stt">"blog.html"</span> template. But you will quickly find that <span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="stt"> </span><span class="RktVar">expr</span><span class="RktPn">)</span> will fail when <span class="RktVar">expr</span> is not syntactically a path, e.g.:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktSym">....</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace">&nbsp;</span><span class="RktSym">logged-in?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"user-info.html"</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"auth.html"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktSym">....</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">What is the solution? The templating system already allows you to parameterize templates so particular components come from the including scope. There is no reason those values can not be the results of other templates. In the previous example, suppose the includer was
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">main-page</span><span class="hspace">&nbsp;</span><span class="RktSym">logged-in?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"site.html"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">We could change it to:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">main-page</span><span class="hspace">&nbsp;</span><span class="RktSym">logged-in?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">user-content</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace">&nbsp;</span><span class="RktSym">logged-in?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"user-info.html"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"auth.html"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"site.html"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p><div class="SIntrapara">and <span class="stt">"site.html"</span> to:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktSym">....</span></td></tr><tr><td><span class="RktSym">user-content</span></td></tr><tr><td><span class="RktSym">....</span></td></tr></table></blockquote></div></p><p>This allows you to do the same thing but is safer and more efficient: safer because there is no way to include templates that are not named by the programmer and more efficient because all the templates are compiled (and optimized) with the rest of the code.</p><p>If you insist on dynamicism, there is always <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=eval.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eval%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">eval</a></span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="test.html" title="backward to &quot;9 Testing Servlets&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Web Applications in Racket&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="doc-index.html" title="forward to &quot;Index&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>