Repository: struts
Updated Branches:
  refs/heads/develop b19ffe9d5 -> bd56838f4


WW-4387 - using original key type for contains method.


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/0c63de2f
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/0c63de2f
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/0c63de2f

Branch: refs/heads/develop
Commit: 0c63de2fa91a76e989848d66afc40c4e50d18622
Parents: d749bb8
Author: Aleksandr Mashchenko <aleksandr...@gmail.com>
Authored: Mon Aug 18 19:17:13 2014 +0300
Committer: Aleksandr Mashchenko <aleksandr...@gmail.com>
Committed: Mon Aug 18 19:17:13 2014 +0300

----------------------------------------------------------------------
 .../main/resources/template/simple/optgroup.ftl |  2 +-
 .../struts2/views/jsp/ui/OptGroupTest.java      | 31 ++++++++++++++
 .../apache/struts2/views/jsp/ui/OptGroup-7.txt  | 43 ++++++++++++++++++++
 3 files changed, 75 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/0c63de2f/core/src/main/resources/template/simple/optgroup.ftl
----------------------------------------------------------------------
diff --git a/core/src/main/resources/template/simple/optgroup.ftl 
b/core/src/main/resources/template/simple/optgroup.ftl
index 8f704f2..c2a15a3 100644
--- a/core/src/main/resources/template/simple/optgroup.ftl
+++ b/core/src/main/resources/template/simple/optgroup.ftl
@@ -39,7 +39,7 @@
        <#assign 
tmpValue=stack.findValue(optGroupInternalListUiBean.parameters.listValue) />
        <#assign tmpKeyStr = tmpKey.toString() />
        <option value="${tmpKeyStr?html}"
-       <#if tag.contains(parameters.nameValue, tmpKeyStr) == true>
+       <#if tag.contains(parameters.nameValue, tmpKey) == true>
        selected="selected"
        </#if>
        >${tmpValue?html}

http://git-wip-us.apache.org/repos/asf/struts/blob/0c63de2f/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java 
b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
index bee7ade..308abca 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
@@ -121,6 +121,37 @@ public class OptGroupTest extends AbstractUITagTest {
         verify(SelectTag.class.getResource("OptGroup-3.txt"));
     }
     
+    public void testOptGroupWithMultipleSelectIntKey() throws Exception {
+      SelectTag selectTag = new SelectTag();
+      selectTag.setMultiple("true");
+      selectTag.setName("mySelection");
+      selectTag.setLabel("My Selection");
+      selectTag.setList("%{#{1:'one',2:'two',3:'three'}}");
+      selectTag.setValue("%{{22,12,2}}");
+
+      OptGroupTag optGroupTag1 = new OptGroupTag();
+      optGroupTag1.setLabel("My Label 1");
+      optGroupTag1.setList("%{#{11:'aaa',12:'bbb',13:'ccc'}}");
+
+      OptGroupTag optGroupTag2 = new OptGroupTag();
+      optGroupTag2.setLabel("My Label 2");
+      optGroupTag2.setList("%{#{21:'ddd',22:'eee',23:'fff'}}");
+
+      selectTag.setPageContext(pageContext);
+      selectTag.doStartTag();
+      optGroupTag1.setPageContext(pageContext);
+      optGroupTag1.doStartTag();
+      optGroupTag1.doEndTag();
+      optGroupTag2.setPageContext(pageContext);
+      optGroupTag2.doStartTag();
+      optGroupTag2.doEndTag();
+      selectTag.doEndTag();
+
+
+      //System.out.println(writer.toString());
+      verify(SelectTag.class.getResource("OptGroup-7.txt"));
+  }
+    
     public void testOptGroupNumbers() throws Exception {
        
        ((TestAction)action).setMap(new LinkedHashMap() {{

http://git-wip-us.apache.org/repos/asf/struts/blob/0c63de2f/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-7.txt
----------------------------------------------------------------------
diff --git 
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-7.txt 
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-7.txt
new file mode 100644
index 0000000..9a31727
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-7.txt
@@ -0,0 +1,43 @@
+<tr>
+    <td class="tdLabel"><label for="mySelection" class="label">My 
Selection:</label></td>
+    <td>
+<select name="mySelection" id="mySelection" multiple="multiple">
+    <option value="1">one</option>
+    <option value="2" selected="selected">two</option>
+    <option value="3">three</option>
+
+<optgroup 
+       label="My Label 1"
+>
+
+       <option value="11"
+       >aaa
+       </option>
+       <option value="12"
+       selected="selected"
+       >bbb
+       </option>
+       <option value="13"
+       >ccc
+       </option>
+</optgroup>
+<optgroup 
+       label="My Label 2"
+>
+
+       <option value="21"
+       >ddd
+       </option>
+       <option value="22"
+       selected="selected"
+       >eee
+       </option>
+       <option value="23"
+       >fff
+       </option>
+</optgroup>
+
+</select>
+<input type="hidden" id="__multiselect_mySelection" 
name="__multiselect_mySelection" value=""/>
+</td>
+</tr>
\ No newline at end of file

Reply via email to