diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/freemarker/spring.ftl b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/freemarker/spring.ftl
index e0f4501b356..4bd0de23cb6 100644
--- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/freemarker/spring.ftl
+++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/freemarker/spring.ftl
@@ -307,10 +307,10 @@
-->
<#macro formCheckbox path attributes="">
<@bind path />
- <#local checked><#if status.value?? && status.value?string=="true">true<#else>false#if>#local>
- <#local id><#if status.expression??>${status.expression}<#else>${path}#if>#local>
+ <#assign id="${status.expression}">
+ <#assign isSelected = status.value?? && status.value?string=="true">
-
+ checked="checked"#if> ${attributes}/>
#macro>
<#--
diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/velocity/spring.vm b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/velocity/spring.vm
index a8d0a1305a1..7126ab3cd93 100644
--- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/velocity/spring.vm
+++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/velocity/spring.vm
@@ -280,8 +280,8 @@
*#
#macro( springFormCheckbox $path $attributes )
#springBind($path)
-
-
+
+
#end
#**
@@ -293,7 +293,7 @@
* @param separator the html tag or other character list that should be used to
* separate each option. Typically ' '.
* @param classOrStyle either the name of a CSS class element (which is defined in
- * the template or an external CSS file) or an inline style. If the value passed in here
+ * the template or an external CSS file) or an inline style. If the value passed in here
* contains a colon (:) then a 'style=' attribute will be used, else a 'class=' attribute
* will be used.
*#
diff --git a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
index 5d162cdb2cc..7b449d6bf4f 100644
--- a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
+++ b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
@@ -122,7 +122,7 @@ public class FreeMarkerMacroTests extends TestCase {
}
catch (Exception ex) {
assertTrue(ex instanceof ServletException);
- assertTrue(ex.getMessage().indexOf(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE) > -1);
+ assertTrue(ex.getMessage().contains(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE));
}
}
@@ -194,9 +194,9 @@ public class FreeMarkerMacroTests extends TestCase {
if (tokens[i].equals("FORM12")) assertEquals("", tokens[i + 1]);
if (tokens[i].equals("FORM13")) assertEquals("", tokens[i + 1]);
if (tokens[i].equals("FORM15")) assertEquals("", tokens[i + 1]);
- if (tokens[i].equals("FORM15")) assertEquals("", tokens[i + 2]);
+ if (tokens[i].equals("FORM15")) assertEquals("", tokens[i + 2]);
if (tokens[i].equals("FORM16")) assertEquals("", tokens[i + 1]);
- if (tokens[i].equals("FORM16")) assertEquals("", tokens[i + 2]);
+ if (tokens[i].equals("FORM16")) assertEquals("", tokens[i + 2]);
}
}
diff --git a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java
index e8406f4c79b..f76a5d32c82 100644
--- a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java
+++ b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/view/velocity/VelocityMacroTests.java
@@ -116,7 +116,7 @@ public class VelocityMacroTests extends TestCase {
}
catch (Exception ex) {
assertTrue(ex instanceof ServletException);
- assertTrue(ex.getMessage().indexOf(VelocityView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE) > -1);
+ assertTrue(ex.getMessage().contains(VelocityView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE));
}
}
@@ -180,9 +180,9 @@ public class VelocityMacroTests extends TestCase {
if (tokens[i].equals("FORM9")) assertEquals("", tokens[i + 1]);
if (tokens[i].equals("FORM10")) assertEquals("", tokens[i + 1]);
if (tokens[i].equals("FORM15")) assertEquals("", tokens[i + 1]);
- if (tokens[i].equals("FORM15")) assertEquals("", tokens[i + 2]);
+ if (tokens[i].equals("FORM15")) assertEquals("", tokens[i + 2]);
if (tokens[i].equals("FORM16")) assertEquals("", tokens[i + 1]);
- if (tokens[i].equals("FORM16")) assertEquals("", tokens[i + 2]);
+ if (tokens[i].equals("FORM16")) assertEquals("", tokens[i + 2]);
}
}