从RichSelectManyChoice ADF oracle和Jdev获取所选项目值

时间:2014-05-22 14:52:46

标签: oracle-adf jdeveloper

我有RichSelectManyChoice, 当用户点击提交按钮时,我想获取所选项目值......

----------------------------------------------- ----------- page.jspx ------------------------------------ -----------------------------------------

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
        <af:document title="untitled1.jspx" id="d1">
            <af:messages id="m1"/>
            <af:form id="f1">
                <af:panelGridLayout id="pgl1">
                    <af:gridRow height="100%" id="gr1">
                        <af:gridCell width="100%" halign="stretch" valign="stretch" id="gc1">
                            <!-- Content -->
                            <af:selectManyChoice value="#{bindings.CountriesView1.inputValue}"
                                                 label="#{bindings.CountriesView1.label}" id="smc1"
                                                 binding="#{suspect.country}" valuePassThru="true">
                                <f:selectItems value="#{bindings.CountriesView1.items}" id="si1"/>
                                <f:validator binding="#{bindings.CountriesView1.validator}"/>
                            </af:selectManyChoice>
                        </af:gridCell>
                    </af:gridRow>
                </af:panelGridLayout>
                <af:button text="button 1" id="b1" action="#{suspect.valide}"/>
            </af:form>
        </af:document>
    </f:view>
</jsp:root>

----------------------------------------------- --------------------- suspect.java -------------------------- -----------------------------------------

package test.view;


import com.sun.org.apache.xpath.internal.operations.String;


import oracle.adf.view.rich.component.rich.input.RichSelectManyChoice;


public class suspect {
    private RichSelectManyChoice country;
    String chaine=null;




    public suspect() {




    }


    public void valide() {
 //getting the selected items values from RichSelectManyChoice

    }


    public void setCountry(RichSelectManyChoice country) {
        this.country = country;
    }


    public RichSelectManyChoice getCountry() {
        return country;
    }
}

任何人都有一个想法PLZ?

1 个答案:

答案 0 :(得分:0)

只需进行一点搜索,您就可以找到有关此内容的大量信息:

public String cb1_action() {
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
JUCtrlListBinding allDepartsmentList = 
       (JUCtrlListBinding) bindings.get("allDepartments");
Object[] selVals = allDepartsmentList.getSelectedValues();
for (int i = 0; i < selVals.length; i++) {
  Integer val = (Integer)selVals[i];
  //...
}
 return null;
}

完整解释如下:https://blogs.oracle.com/jdevotnharvest/entry/how_to_access_selected_rows