<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=ramseylubbat" rel="nofollow">Ramsey Lubbat</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3427?redirect=false" rel="nofollow">SPR-3427</a></strong> and commented</p>
<p dir="auto">When using FreeMarker's capability to use JSP taglibs in FreeMarker templates, two of the Spring form tags, errors and option, do not render their output.</p>
<p dir="auto">To reproduce, configure your SpringMVC application for FreeMarker views. The standard documentation should help with this.</p>
<p dir="auto">Then, in one of your FreeMarker templates, assign the Spring form taglibs and try to use the errors or option tag:</p>
<p dir="auto">&lt;#assign form=JspTaglibs["http://www.springframework.org/tags/form"]/&gt;<br>
&lt;<code class="notranslate">@form</code>:form&gt;<br>
&lt;<code class="notranslate">@form</code>.errors path="name" /&gt;<br>
&lt;<code class="notranslate">@form</code>.input path="name" /&gt;<br>
&lt;br/&gt;&lt;input type="submit" /&gt;<br>
&lt;/<code class="notranslate">@form</code>:form&gt;</p>
<p dir="auto">Make sure a form validation error occurs for the value you submit. When the page is displayed again, with the form errors, no error message is rendered at all. By using the debugger, we see that the tag is doing the correct thing (looking up the error message and outputting a span element with the resolved message), but the output never makes it to the response. You see no error message on the page.</p>
<p dir="auto">We think that these two tags do not render because they extend AbstractHtmlElementBodyTag and the TagWriter usage interacts poorly with FreeMarker's TagTransformModel and Environment classes. Sorry for the lack of a more explicit explanation, but essentially, the output writer that TagWriter is constructed with gets swapped around by FreeMarker, so the output from the tags never gets written to the response.</p>
<p dir="auto">To solve this problem, one of our engineers came up with the solution to extend ErrorsTag and OptionTag, overloading the renderDefaultContent() method to call the base class method with a new TagWriter constructed with pageContext.getOut(). I'll attach our fix.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.3, 2.0.4</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/12573/ErrorsTag.java" rel="nofollow">ErrorsTag.java</a> (<em>756 bytes</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398075799" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7888" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7888/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7888">#7888</a> form:errors tag does not render in freemarker view (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398081451" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/8634" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/8634/hovercard" href="https://github.com/spring-projects/spring-framework/issues/8634">#8634</a> JSP taglib with FreeMarker doesn't print errors (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=novoj" rel="nofollow">Jan Novotný</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-5177?redirect=false" rel="nofollow">SPR-5177</a></strong> and commented</p>
<p dir="auto">Using ConfigurableMimeFileTypeMap I found out, that for any file with extension "css" - ie. HTML stylesheets method getContentType(...) returns "application/x-pointplus" instead of expected "text/css". Firefox gets confused and refuses such stylesheets.</p>
<p dir="auto">Problem is in double definition of mimetype for extension "css" in mime.types file included in spring.jar in package org/springframework/mail/javamail/</p>
<p dir="auto">Exactly:</p>
<ol dir="auto">
<li>TEXT TYPES</li>
</ol>
<p dir="auto">text/x-speech				talk<br>
text/css				css</p>
<p dir="auto">and then:</p>
<ol dir="auto">
<li>
<p dir="auto">PRESENTATION</p>
</li>
<li>
<p dir="auto">PowerPoint presentation (Microsoft)<br>
application/mspowerpoint		ppz</p>
</li>
<li>
<p dir="auto">PointPlus presentation data (Net Scene)<br>
application/x-pointplus			css</p>
</li>
<li>
<p dir="auto">ASAP WordPower (Software Publishing Corp.)<br>
application/x-asap			asp</p>
</li>
<li>
<p dir="auto">Astound Web Player multimedia data (GoldDisk)<br>
application/astound			asn</p>
</li>
</ol>
<p dir="auto">Next definition overwrites the previous one, which IMHO is more important.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.5</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398089086" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9587" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9587/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9587">#9587</a> Duplicate mappings in org/springframework/mail/mime.types (<em><strong>"duplicates"</strong></em>)</li>
</ul>