<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=goonie" rel="nofollow">Andreas Schildbach</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2299?redirect=false" rel="nofollow">SPR-2299</a></strong> and commented</p>
<p dir="auto">Please consider this code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;spring:bind path=&quot;command.rules&quot;&gt;
         &lt;form:select path=&quot;rules&quot;&gt;
                  &lt;c:forEach var=&quot;rule&quot; items=&quot;${rules}&quot;&gt;
                           &lt;spring:transform var=&quot;key&quot; value=&quot;${rule}&quot;/&gt;
                           &lt;fmt:message var=&quot;label&quot; key=&quot;rules.${key}&quot;/&gt;
                           &lt;form:option value=&quot;${rule}&quot; label=&quot;${label}&quot;/&gt;
                  &lt;/c:forEach&gt;
         &lt;/form:select&gt;
&lt;/spring:bind&gt;"><pre class="notranslate"><code class="notranslate">&lt;spring:bind path="command.rules"&gt;
         &lt;form:select path="rules"&gt;
                  &lt;c:forEach var="rule" items="${rules}"&gt;
                           &lt;spring:transform var="key" value="${rule}"/&gt;
                           &lt;fmt:message var="label" key="rules.${key}"/&gt;
                           &lt;form:option value="${rule}" label="${label}"/&gt;
                  &lt;/c:forEach&gt;
         &lt;/form:select&gt;
&lt;/spring:bind&gt;
</code></pre></div>
<p dir="auto">As you can see, I need to duplicate the reference to the "rules" property in my command, just to be able to use the (very convenient) new form tags and still be able to convert my form objects to strings using the registered property editors with spring:transform. Spring:transform needs its own context, which is defined with spring:bind.</p>
<p dir="auto">I propose to add a form:transform tag with similar syntax to spring:transform, which uses the context of form:select (and similar) tags instead. This would reduce the code to something like</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;form:select path=&quot;rules&quot;&gt;
         &lt;c:forEach var=&quot;rule&quot; items=&quot;${rules}&quot;&gt;
                  &lt;form:transform var=&quot;key&quot; value=&quot;${rule}&quot;/&gt;
                  &lt;fmt:message var=&quot;label&quot; key=&quot;rules.${key}&quot;/&gt;
                  &lt;form:option value=&quot;${rule}&quot; label=&quot;${label}&quot;/&gt;
         &lt;/c:forEach&gt;
&lt;/form:select&gt;"><pre class="notranslate"><code class="notranslate">&lt;form:select path="rules"&gt;
         &lt;c:forEach var="rule" items="${rules}"&gt;
                  &lt;form:transform var="key" value="${rule}"/&gt;
                  &lt;fmt:message var="label" key="rules.${key}"/&gt;
                  &lt;form:option value="${rule}" label="${label}"/&gt;
         &lt;/c:forEach&gt;
&lt;/form:select&gt;
</code></pre></div>
<p dir="auto">which is much more readable and only has got one reference to the command property.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0 RC2</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="398077876" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/8144" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/8144/hovercard" href="https://github.com/spring-projects/spring-framework/issues/8144">#8144</a> form:form should work like spring:nestedPath</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=outdooricon" rel="nofollow">Johnathon</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8355?redirect=false" rel="nofollow">SPR-8355</a></strong> and commented</p>
<p dir="auto">When sorting the following array: [/a/b/{c}/<strong>, /a/b/{c}/</strong>/, /<strong>, /</strong>/] with the current implementation of AntPathMatcher.AntPatternComparator, the sort order results in: [/<strong>/, /</strong>, /a/b/{c}/<strong>/, /a/b/{c}/</strong>] . In our case, this results in the wrong controller picking up the request.</p>
<p dir="auto">I believe the problem lies in this block:<br>
if (totalCount1 != totalCount2) {<br>
return totalCount1 - totalCount2;<br>
}<br>
and would be correct if instead it returned "totalCount2 - totalCount1;". However, I can't speak to how this may affect other use cases.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.4, 3.0.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="398158936" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/15181" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/15181/hovercard" href="https://github.com/spring-projects/spring-framework/issues/15181">#15181</a> Assign lowest priority to "/<strong>" in AntPathMatcher (_</strong>"duplicates"**_)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398114462" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13325" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13325/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13325">#13325</a> AntPathMatcher.AntPatternComparator algorithm wrong for hierarchical matches</li>
</ul>
<p dir="auto">3 votes, 3 watchers</p>