<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Spring on technocracy</title><link>https://www.ericsimmerman.com/tags/spring/</link><description>Recent content in Spring on technocracy</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 21 Feb 2009 00:00:00 +0000</lastBuildDate><atom:link href="https://www.ericsimmerman.com/tags/spring/index.xml" rel="self" type="application/rss+xml"/><item><title>Spring MVC's checkboxes tag and support for enum</title><link>https://www.ericsimmerman.com/blog/2009/02/21/spring-mvcs-checkboxes-tag-and-support-for-enum/</link><pubDate>Sat, 21 Feb 2009 00:00:00 +0000</pubDate><guid>https://www.ericsimmerman.com/blog/2009/02/21/spring-mvcs-checkboxes-tag-and-support-for-enum/</guid><description>&lt;div class='post'&gt;
Using Spring MVC's checkboxes (or radiobuttons) tag to render form inputs for an enum property is easy and clean...once you know how. After a little gnashing of teeth, due to the fact that I needed a specific display order for all options, I found the following solution:&lt;p /&gt;Here's the tag in my jsp&lt;div class="CodeRay"&gt; &lt;div class="code"&gt;&lt;pre&gt;&amp;lt;form:checkboxes itemValue=&amp;quot;value&amp;quot; itemLabel=&amp;quot;label&amp;quot; path=&amp;quot;user.degrees&amp;quot; items=&amp;quot;${degreeLabels }&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Here's the way I populated my model map to retain ordering. (I placed this code in my FormController's referenceData method)&lt;div class="CodeRay"&gt; &lt;div class="code"&gt;&lt;pre&gt;List labelValues = new ArrayList&amp;lt;LabelValue&amp;gt;(); for (Degree d : Degree.values()) { labelValues.add(new LabelValue(d.name(), d.name())); } Map model = new HashMap(); model.put(&amp;quot;degreeLabels&amp;quot;, labelValues);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;FYI, I ripped the LabelValue class used above from Matt Riable's excellent Appfuse project. The constructor takes two arguments which are mapped to the properties "value" and "label" and these properties have the typical pojo getters and setters.&lt;br /&gt;You can see from the path on my tag that degrees is a property on my User object...which is the target of my form. Here's what that looks like...I threw in my Hibernate annotations for the curious:&lt;div class="CodeRay"&gt; &lt;div class="code"&gt;&lt;pre&gt;private Set&amp;lt;Degree&amp;gt; degrees = new HashSet&amp;lt;Degree&amp;gt;(); @CollectionOfElements @Enumerated(EnumType.STRING) public Set&amp;lt;Degree&amp;gt; getDegrees() { return degrees; } public void setDegrees(Set&amp;lt;Degree&amp;gt; degrees) { this.degrees = degrees; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;It's probably obvious, but here's what the Degree enum looks like:&lt;div class="CodeRay"&gt; &lt;div class="code"&gt;&lt;pre&gt;public enum Degree { BA,BS,BN,BSW,MA,MS,MBA,MSN,MSW,MD,JD,PhD,PharmD,PsyD,Other;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description></item><item><title>Spring JMS Remoting support for async calls and methods with void return types</title><link>https://www.ericsimmerman.com/blog/2008/05/28/spring-jms-remoting-support-for-async-calls-and-methods-with-void-return-types/</link><pubDate>Wed, 28 May 2008 00:00:00 +0000</pubDate><guid>https://www.ericsimmerman.com/blog/2008/05/28/spring-jms-remoting-support-for-async-calls-and-methods-with-void-return-types/</guid><description>&lt;div class='post'&gt;
I've submitted a patch to the Spring Framework to give their &lt;a href="http://jira.springframework.org/browse/SPR-4427"&gt;JMS remoting feature support for async calls and methods with void return types&lt;/a&gt;. The associated Jira ticket (&lt;a href="http://jira.springframework.org/browse/SPR-4427"&gt;SPR-4427&lt;/a&gt;) could use a few votes if you are so inclined.&lt;/div&gt;</description></item></channel></rss>