backing bean how to get options which are changed sequence by javascript

In page, I change the sequence of options which created by tag <f:selectItems> via javascript,

so in backing bean, I must catch the correct sequence of options.

How to achieve it?

In page I binding selectOneListbox tag with backing bean's UIInput property "subCategoryList". but can't get the correct sequence of options.

<--page-->

<h:selectOneListbox id="childOrgs" value="#{orgDelegate.lsOrg.orgName}" binding="#{orgDelegate.subCategoryList}" actionListener="#{orgDelegate.getOrgsFromClient} >

<f:selectItems id="orgNames" value="#{orgDelegate.orgNames}" />

</h:selectOneListbox>

<--backing bean-->

public class LsOrgDelegate extends BaseDelegate {

private HtmlSelectOneListbox selObj;

private UIInput subCategoryList;

{

subCategoryList = new HtmlSelectOneListbox();

}

public UIInput getSubCategoryList() {

return subCategoryList;

}

public void setSubCategoryList(UIInput subCategoryList) {

this.subCategoryList = subCategoryList;

ArrayList list = new ArrayList();

if (subCategoryList != null){

UISelectItems items = (UISelectItems) subCategoryList.getChildren().get(0);

Iterator iter = items.getChildren().iterator();

while(iter.hasNext()){

UIComponent kid = (UIComponent) iter.next();

if (kid instanceof UISelectItem) {

Object value = ((UISelectItem) kid).getValue();

if (value == null) {

} else if (value instanceof SelectItem) {

list.add(value);

} else {

throw new IllegalArgumentException(Util.getExceptionMessageString(

Util.CONVERSION_ERROR_MESSAGE_ID));

}

}

}

}

if (list != null && !list.isEmpty()){

this.orgNames.clear();

this.orgNames.addAll(list);

}

}

}

How to achieve this?

[1914 byte] By [jack.yuana] at [2007-11-26 16:11:19]
# 1

function moveDown()

{

var selObj = document.getElementById("org_rank:childOrgs");

var index = selObj.selectedIndex;

if (index == -1 || index >= selObj.options.length - 1)

return;

var selectedText = selObj.options[index].text;

var selectedValue = selObj.options[index].value;

selObj.options[index].text = selObj.options[index + 1].text;

selObj.options[index].value = selObj.options[index + 1].value;

selObj.options[index + 1].text = selectedText;

selObj.options[index + 1].value = selectedValue;

//selObj.options[index + 1].selected = true;

}

I change the sequence of options via javascript,

why JSF will go through Restore View, Apply Request Value,

Process Validations, Render Response four lifecycle.

It's terrible!

jack.yuana at 2007-7-8 22:33:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
help
jack.yuana at 2007-7-8 22:33:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...