在jsp页面中,我<s:optiontransferselect>在左侧和右侧之间有一个交换值和一个保存的提交按钮.
<s:optiontransferselect
allowUpDownOnLeft="false"
allowUpDownOnRight="false"
allowSelectAll="false"
allowAddAllToLeft="false"
allowAddAllToRight="false"
addToRightLabel="Go to right"
addToLeftLabel="Go to left"
leftTitle="Left side values"
headerKey="0"
name="option"
list= "optionList"
rightTitle="Right side values"
doubleHeaderKey="0"
doubleList="selectedOptionList"
doubleName="selectOption"
doubleId="selectedValues"
>
</s:optiontransferselect>
<s:submit />
Run Code Online (Sandbox Code Playgroud)
我运行程序,它实际上可以从右侧保存值.但是它没有显示保存的值.
我正在考虑使用javascript并使用onchange事件<s:optiontransferselect>来实现这一目标
<script>
function show(){
var list = document.getElementById("selectedValues");
for (var i = 0; i < list.options.length; i++) {
//seems something not correct in this part but I am not sure how solve in this way
list.options[i].selected = true;
}
return true;
} …Run Code Online (Sandbox Code Playgroud)