<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=przemek.ch" rel="nofollow">Przemek Ch</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8732?redirect=false" rel="nofollow">SPR-8732</a></strong> and commented</p>
<p dir="auto">Method</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="protected String autogenerateId() throws JspException {
     return StringUtils.deleteAny(getName(), &quot;[]&quot;);
}"><pre class="notranslate"><span class="pl-k">protected</span> <span class="pl-smi">String</span> <span class="pl-s1">autogenerateId</span>() <span class="pl-k">throws</span> <span class="pl-s1">JspException</span> {
     <span class="pl-k">return</span> <span class="pl-smi">StringUtils</span>.<span class="pl-en">deleteAny</span>(<span class="pl-en">getName</span>(), <span class="pl-s">"[]"</span>);
}</pre></div>
<p dir="auto">form AbstractDataBoundFormElementTag class doesn't work with freemarker.</p>
<p dir="auto">Example</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;@spring.formInput path=&quot;lead.additionalSalesList[1].saleResult.policyId&quot; attributes='class=&quot;policyId_1&quot;'/&gt;"><pre class="notranslate">&lt;@spring.formInput path="lead.additionalSalesList[1].saleResult.policyId" attributes='class="policyId_1"'/&gt;</pre></div>
<p dir="auto">generates</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;input id=&quot;additionalSalesList[1].saleResult.policyId&quot; class=&quot;policyId_0&quot; type=&quot;text&quot; value=&quot;&quot; name=&quot;additionalSalesList[1].saleResult.policyId&quot;&gt;"><pre class="notranslate">&lt;<span class="pl-ent">input</span> <span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>additionalSalesList[1].saleResult.policyId<span class="pl-pds">"</span></span> <span class="pl-e">class</span>=<span class="pl-s"><span class="pl-pds">"</span>policyId_0<span class="pl-pds">"</span></span> <span class="pl-e">type</span>=<span class="pl-s"><span class="pl-pds">"</span>text<span class="pl-pds">"</span></span> <span class="pl-e">value</span>=<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span> <span class="pl-e">name</span>=<span class="pl-s"><span class="pl-pds">"</span>additionalSalesList[1].saleResult.policyId<span class="pl-pds">"</span></span>&gt;</pre></div>
<p dir="auto">According to <a href="https://jira.springsource.org/browse/SPR-2380" rel="nofollow">https://jira.springsource.org/browse/SPR-2380</a> the code above should generate id="additionalSalesList1.saleResult.policyId"</p>
<p dir="auto">[] in ID is not a valid HTML so libraries like jQuery cant handle such elements</p>
<p dir="auto">Tricks like this <code class="notranslate">$(":input[name='additionalSalesList[1]\\.saleResult\\.policyId']")</code> are needed now to select such items using jQuery.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.6</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="398108500" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12366" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12366/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12366">#12366</a> Using array syntax generates invalid id in freemarker (<em><strong>"duplicates"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398091064" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9845" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9845/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9845">#9845</a> Binding in Velocity templates using EL accessors ([, ]) for collections produces non xhtml strict compliant output</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/ba03d5b0c7d7211f910c5bc48c0895fe86614104/hovercard" href="https://github.com/spring-projects/spring-framework/commit/ba03d5b0c7d7211f910c5bc48c0895fe86614104"><tt>ba03d5b</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/e7e74c83d84dcd552d0e75458c91bc920e64d4d4/hovercard" href="https://github.com/spring-projects/spring-framework/commit/e7e74c83d84dcd552d0e75458c91bc920e64d4d4"><tt>e7e74c8</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/a9f42061510e5015965a6a680d866db519b5356d/hovercard" href="https://github.com/spring-projects/spring-framework/commit/a9f42061510e5015965a6a680d866db519b5356d"><tt>a9f4206</tt></a></p>
<p dir="auto">2 votes, 5 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=egervari" rel="nofollow">Ken Egervari</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6163?redirect=false" rel="nofollow">SPR-6163</a></strong> and commented</p>
<p dir="auto">Using ignore accept header and default content type causes problems. Here is my bean xml:</p>
<p dir="auto">{code?xml}<br>
&lt;bean id="contentNegotiatingViewResolver"<br>
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;<br>
&lt;property name="order" value="1"/&gt;<br>
&lt;property name="ignoreAcceptHeader" value="true" /&gt;<br>
&lt;property name="defaultContentType" value="text/html" /&gt;<br>
&lt;property name="mediaTypes"&gt;<br>
&lt;map&gt;<br>
&lt;entry key="ftl" value="text/html"/&gt;<br>
&lt;entry key="xml" value="application/xml"/&gt;<br>
&lt;entry key="json" value="application/json"/&gt;<br>
&lt;entry key="atom" value="application/atom+xml"/&gt;<br>
&lt;entry key="rss" value="application/rss+xml"/&gt;<br>
&lt;/map&gt;<br>
&lt;/property&gt;<br>
&lt;property name="defaultViews"&gt;<br>
&lt;list&gt;<br>
&lt;bean class="org.springframework.web.servlet.view.xml.MarshallingView"&gt;<br>
&lt;property name="contentType" value="application/xml" /&gt;<br>
&lt;property name="marshaller"&gt;<br>
&lt;bean class="org.springframework.oxm.xstream.XStreamMarshaller"&gt;<br>
&lt;property name="autodetectAnnotations" value="true"/&gt;<br>
&lt;/bean&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"&gt;<br>
&lt;property name="contentType" value="application/json" /&gt;<br>
&lt;/bean&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;property name="viewResolvers"&gt;<br>
&lt;list&gt;<br>
&lt;bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"&gt;<br>
&lt;property name="contentType" value="text/html" /&gt;<br>
&lt;property name="order" value="2"/&gt;<br>
&lt;property name="cache" value="false"/&gt;<br>
&lt;property name="prefix" value=""/&gt;<br>
&lt;property name="suffix" value=".ftl"/&gt;<br>
&lt;property name="exposeSpringMacroHelpers" value="true"/&gt;<br>
&lt;/bean&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Here is the exception that is generated:
"><pre class="notranslate"><code class="notranslate">
Here is the exception that is generated:

</code></pre></div>
<p dir="auto">SEVERE: Servlet.service() for servlet jawbs threw exception<br>
java.lang.UnsupportedOperationException<br>
at java.util.AbstractList.set(AbstractList.java:115)<br>
at java.util.AbstractList$ListItr.set(AbstractList.java:412)<br>
at java.util.Collections.sort(Collections.java:121)<br>
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.resolveViewName(ContentNegotiatingViewResolver.java:344)<br>
at org.springframework.web.servlet.DispatcherServlet.resolveViewName(DispatcherServlet.java:1105)<br>
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1052)<br>
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:808)<br>
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:726)<br>
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:636)<br>
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:545)<br>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)<br>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)<br>
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<br>
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
If there is a short-term fix, I'd love to hear it.

Basically what I want to do is have no extension (like /rest/hotels/list) go to text/html and still have the json, xml, etc. views work with the extensions on any/all browsers.

Thanks!"><pre class="notranslate"><code class="notranslate">
If there is a short-term fix, I'd love to hear it.

Basically what I want to do is have no extension (like /rest/hotels/list) go to text/html and still have the json, xml, etc. views work with the extensions on any/all browsers.

Thanks!
</code></pre></div>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 RC1</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="398097922" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10846" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10846/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10846">#10846</a> Using defaultContentType property in ContentNegotiatingViewResolver throws java.lang.UnsupportedOperationException (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/0c47a01953d060a6aa8f306b03730078a60ddf39/hovercard" href="https://github.com/spring-projects/spring-framework/commit/0c47a01953d060a6aa8f306b03730078a60ddf39"><tt>0c47a01</tt></a></p>