Author: rgielen Date: Tue Feb 12 08:07:46 2008 New Revision: 620841 URL: http://svn.apache.org/viewvc?rev=620841&view=rev Log: WW-2482: Fix Freemarker exception when model list entry has null value field
Modified: struts/struts2/trunk/core/src/main/resources/template/simple/checkboxlist.ftl struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt Modified: struts/struts2/trunk/core/src/main/resources/template/simple/checkboxlist.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/checkboxlist.ftl?rev=620841&r1=620840&r2=620841&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/checkboxlist.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/checkboxlist.ftl Tue Feb 12 08:07:46 2008 @@ -30,7 +30,7 @@ <#assign itemKey = stack.findValue('top')/> </#if> <#if parameters.listValue?exists> - <#assign itemValue = stack.findString(parameters.listValue)/> + <#assign itemValue = stack.findString(parameters.listValue)?default("")/> <#else> <#assign itemValue = stack.findString('top')/> </#if> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java?rev=620841&r1=620840&r2=620841&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java Tue Feb 12 08:07:46 2008 @@ -134,7 +134,8 @@ testAction.setFoo("hello"); testAction.setList(new String[][]{ {"hello", "world"}, - {"foo", "bar"} + {"foo", "bar"}, + {"baz", null} }); CheckboxListTag tag = new CheckboxListTag(); Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt?rev=620841&r1=620840&r2=620841&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt Tue Feb 12 08:07:46 2008 @@ -5,5 +5,7 @@ <label for="foo-1" class="checkboxLabel">world</label> <input type="checkbox" name="foo" value="foo" id="foo-2" title="mytitle" onchange="alert('foo');"/> <label for="foo-2" class="checkboxLabel">bar</label> +<input type="checkbox" name="foo" value="baz" id="foo-3" title="mytitle" onchange="alert('foo');"/> +<label for="foo-3" class="checkboxLabel"></label> </td> </tr>