Spring MVC, freemarker boolean form check.

    <#macro booleanFormCheck path attributes="">
    <@spring.bind path/>
    <input type="checkbox" id="${spring.status.expression}" name="${spring.status.expression}" value="true"
    <#if spring.stringStatusValue == "true">checked="checked"</#if> ${attributes}
    <#assign hiddenName = "_"+spring.status.expression/>
    <input type="hidden" name="${hiddenName}">
First off, I must be the 100th person to write this. A little boolean formCheck that puts the hidden field in for you? spring.ftl is well and good, but how about a new bloatedSpring.ftl with lots of goodies like this one.

Printing a date that might be null in freemarker

Sounds easy right? Well, I'm sure it is, but damn if I didn't spend a half hour massaging my temples. (oh and I'm positive there's a lovely way to do this in place, but I'll be damned if I'm going to spend any more time looking.
    <#macro printDate date="">     <#if date?has_content> ${date?date?string.short}     <#else> None Provided     </#if></#macro>

Turning a number that's been turned into a string back into a number.

(If the number is greater than 999)Right. So it all works fine. You've got a nice drop-down select. Now you (silly thing that you are) want a confirmation page, but rather than telling them they've selected pop-rocks flavor #38, you want to tell them that they've selected flavor "Rasberry Crush", so pop that back in the referenceData and off you go... up until you get to flavor 1000 (or should I say "1,000"). Then you spend a while sitting in front of the people you convinced ot ditch jsp, helplessly trying to change you internationalization settings to take out commas and having simple no luck with ?int and it's ilk... until you find... ?c
<#macro printLookup array element>    <#if element?exists && element?string == "-1">      None Provided     <#else>      ${array[element?c]}     
Happily this also solves other infuriating 9300->"9300"->(int)9,300 freemarker bind exception explosions:
<#macro formInputInt path attributes="" fieldType="text" >    <@spring.bind path/>    ${spring.status.value?default(0)?c}" ${attributes}    <@spring.closeTag/><#macro formHiddenInputInt path attributes="" >    <@formInputInt path, attributes, "hidden"/>