mirror of
https://github.com/apache/struts.git
synced 2026-08-11 09:36:57 +00:00
WW-4387 - using original key type for contains method.
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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() {{
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user