@@ -107,7 +107,7 @@ protected void processTemplate(Template template, SimpleHash fmModel, HttpServle
107107 fv .setApplicationContext (wac );
108108 fv .setExposeSpringMacroHelpers (true );
109109
110- Map model = new HashMap ();
110+ Map < String , Object > model = new HashMap < String , Object > ();
111111 model .put ("tb" , new TestBean ("juergen" , 99 ));
112112 fv .render (model , request , response );
113113 }
@@ -126,7 +126,7 @@ protected void processTemplate(Template template, SimpleHash model, HttpServletR
126126 fv .setApplicationContext (wac );
127127 fv .setExposeSpringMacroHelpers (true );
128128
129- Map model = new HashMap ();
129+ Map < String , Object > model = new HashMap < String , Object > ();
130130 model .put (FreeMarkerView .SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE , helperTool );
131131
132132 try {
@@ -265,6 +265,13 @@ public void testForm17() throws Exception {
265265 assertEquals ("<input type=\" text\" id=\" spouses0.name\" name=\" spouses[0].name\" value=\" Fred\" >" , getMacroOutput ("FORM17" ));
266266 }
267267
268+ @ Test
269+ public void testForm18 () throws Exception {
270+ String output = getMacroOutput ("FORM18" );
271+ assertTrue ("Wrong output: " + output , output .startsWith ("<input type=\" hidden\" name=\" _spouses[0].jedi\" value=\" on\" />" ));
272+ assertTrue ("Wrong output: " + output , output .contains ("<input type=\" checkbox\" id=\" spouses0.jedi\" name=\" spouses[0].jedi\" checked=\" checked\" />" ));
273+ }
274+
268275 private String getMacroOutput (String name ) throws Exception {
269276
270277 String macro = fetchMacro (name );
@@ -274,30 +281,32 @@ private String getMacroOutput(String name) throws Exception {
274281 FileCopyUtils .copy ("<#import \" spring.ftl\" as spring />\n " + macro , new FileWriter (resource .getPath ()));
275282
276283 DummyMacroRequestContext rc = new DummyMacroRequestContext (request );
277- Map msgMap = new HashMap ();
284+ Map < String , String > msgMap = new HashMap < String , String > ();
278285 msgMap .put ("hello" , "Howdy" );
279286 msgMap .put ("world" , "Mundo" );
280287 rc .setMessageMap (msgMap );
281- Map themeMsgMap = new HashMap ();
288+ Map < String , String > themeMsgMap = new HashMap < String , String > ();
282289 themeMsgMap .put ("hello" , "Howdy!" );
283290 themeMsgMap .put ("world" , "Mundo!" );
284291 rc .setThemeMessageMap (themeMsgMap );
285292 rc .setContextPath ("/springtest" );
286293
287- TestBean tb = new TestBean ("Darren" , 99 );
288- tb .setSpouse (new TestBean ("Fred" ));
289- tb .setJedi (true );
290- request .setAttribute ("command" , tb );
294+ TestBean darren = new TestBean ("Darren" , 99 );
295+ TestBean fred = new TestBean ("Fred" );
296+ fred .setJedi (true );
297+ darren .setSpouse (fred );
298+ darren .setJedi (true );
299+ request .setAttribute ("command" , darren );
291300
292- HashMap names = new HashMap ();
301+ Map < String , String > names = new HashMap < String , String > ();
293302 names .put ("Darren" , "Darren Davison" );
294303 names .put ("John" , "John Doe" );
295304 names .put ("Fred" , "Fred Bloggs" );
296305 names .put ("Rob&Harrop" , "Rob Harrop" );
297306
298307 Configuration config = fc .getConfiguration ();
299- Map model = new HashMap ();
300- model .put ("command" , tb );
308+ Map < String , Object > model = new HashMap < String , Object > ();
309+ model .put ("command" , darren );
301310 model .put ("springMacroRequestContext" , rc );
302311 model .put ("msgArgs" , new Object [] { "World" });
303312 model .put ("nameOptionMap" , names );
0 commit comments