Preselection in SelectManyCheckbox

Hi.
I'm starting with Oracle ADF and JDeveloper. I have read similar questions before, but I still have trouble with it.
So, please excuse me in advance.
Starting from classic HR schema for Oracle ADF (Departments, Employees, Regions, Countries, etc.), I drop a SelectOneChoice for DepartmentsView1, and then I drop a SelectManyCheckbox for related EmployeesView3. This is ok.
When I change Department value, the SelectManyCheckbox component reloads with new selected department's employees. This is ok too.
Well, I need that, in change Department value, all the checkboxes for related employees were checked (preselected).
As I told before, I have read some posts, forums, etc. but I can't get a solution.
I have linked a bean to the SelectManyCheckbox value, read the iterator values, but I don't know how to mark that checkboxes by default.
I have tried (in a wrong way, I suppose):
Get the related FacesCtrlListBinding and invoke setSelectedIndex from 0 to n.
Get the related FacesCtrlListBinding and invoke setSelectedIndex from first Employee ID from the selected Department (114, for example) to the last Employee ID.
Generate a List<String> preselected values in SelectManyCheckbox component.
Could anyone help me with this, maybe easy, issue?
Any suggestion would be very appreciated.
Thanks in advance.

Can you please confirm if you wanted the below to be achieved.
'See only those rows where your turn-over is greater than/ equal to/ lesser than a particular value'.
If that is indeed, then you can create an 'Exception' in your Query designer. In this Exception, create required condition for your keyfigure turnover. Once this is done, your query will give output based on the condition that you have created.
Applying the solution which Shafi has provided will mean that you would be able to see only the values of a particular keyfigure which has been selected as default keyfigure in your query.
eg. If you have 2 keyfigures key1 and key2, then by using dropdown to select a keyfigure, you can decide which of these keyfigures should be shown in your query output but it will by no mean restrict your keyfigure value

Similar Messages

  • Setting check mark for SelectManyCheckbox item

    I'm trying to set the check mark for a SelectManyCheckbox item from a backing bean and cannot find any explicit explanation or example to do this. This would be used to have a command button select all checkboxes and a command button to clear all checkboxes.
    I've been trying to set the SelectItem value, but while log messages suggest what is desired has occurred, nothing visually changes. Here's the key parts of what I'm working with so far.
    <h:selectManyCheckbox
      id="patients" layout="pageDirection"
      value="#{SelectBean.patientsSelected}" >
      <f:selectItems value="#{SelectBean.patientSelects}" />
    </h:selectManyCheckbox>
    <h:commandButton type="submit" value="Select All Patients"
      id="allPatients"
      action="update"
      actionListener="#{SelectBean.onSelectAll}" />
    private Collection<SelectItem> patientSelects;
    private List<String> patientsSelected;
    for (int i = 0; i < 10; i++) {
      value = false;
      label = locationSelected + "-" + "patient" + Integer.toString(i);
      patientSelects.add(new SelectItem(value, label));
    public void onSelectAll(ActionEvent event) {
      for (Iterator it = patientSelects.iterator(); it.hasNext();) {
        SelectItem si = (SelectItem) it.next();
          si.setValue(true);
    }

    the arrayList you suggest doesn't even contain these items.You have to prefill the patientsSelected yourself to mark preselected items.
    Basic example:<h:selectManyCheckbox value="#{myBean.selectedItems}" />
        <f:selectItems value="#{myBean.selectItems}" />
    </h:selectManyCheckbox>MyBeanprivate List<String> selectedItems; // + getter + setter
    private List<SelectItem> selectItems; // + getter + setter
        // Prefill selectItems.
        selectItems = new ArrayList<SelectItem>();
        selectItems.add(new SelectItem("value1", "label1"));
        selectItems.add(new SelectItem("value2", "label2"));
        selectItems.add(new SelectItem("value3", "label3"));
        selectItems.add(new SelectItem("value4", "label4"));
        selectItems.add(new SelectItem("value5", "label5"));
        // Preselect item #2 and #4.
        selectedItems = new ArrayList<String>();
        selectedItems.add("value2");
        selectedItems.add("value4");
    }

  • How to get selected values from selectManyCheckbox ?

    Hi,
    I am a SOA developer and using 'Auto generated adf form' of Human Task. I did some customization in the form. I need to show one dynamic list (contains multiple string values) on a form, from which user will select desired values. For this I have used <af:selectManyCheckbox> adf component.
    It has generated code as follows...
    <af:selectManyCheckbox value="#{bindings.Response.inputValue}"
                                             label="#{bindings.Response.label}"
                                             id="smc1">
                        <f:selectItems value="#{bindings.Response.items}" id="si9"/>
    </af:selectManyCheckbox>
    I am able to show list on a form and can select multiple values also.
    Now, I want the multiple selected values back in my BPEL process. I need only those values which are selected by user.
    Currently I am getting complete list as it is back in BPEL process.
    Please help me out..!
    Thanks..
    Suraj

    Unwinding ADF: How to retrieve Selected Items from selectManyCheckbox using ValueChnageListener

  • How to get selected values from af:selectManyCheckbox

    Hi i am using jdeveloper 11.1.2 and i drag n drop a view object as Multiple select (<af:selectManyCheckbox) component and now i am trying to get the checked values in backing bean so that i can save in the database.
    Right now i am getting all the values but not the selected values.
    JSPX Page.
    <af:selectManyCheckbox value="#{bindings.HREmpDetailsVO1.inputValue}"
    label="EMPLOYEES"
    binding="#{backingBeanScope.backing_TestForm.smc1}"
    id="smc1">
    <f:selectItems value="#{bindings.HREmpDetailsVO1.items}"
    binding="#{backingBeanScope.backing_TestForm.si1}"
    id="si1"/>
    </af:selectManyCheckbox>
    Bean Class:
    public List getSelectedValues() {
    if (selectedValues == null || refreshSelectedList) {
    selectedValues =
    attributeListForIterator(selectedValuesIteratorName,
    selectedValuesValueAttrName);
    return selectedValues;
    public static List attributeListForIterator(DCIteratorBinding iter,
    String valueAttrName) {
    List attributeList = new ArrayList();
    for (Row r : iter.getAllRowsInRange()) {
    attributeList.add(r.getAttribute(valueAttrName));
    return attributeList;
    Can some one pls help me in getting the values with sample code.
    Thanks in advance

    Thank you so much for your help. But i am getting null values in the SOP. I could get count of selected values but not the values.

  • Please, How do i get the values from a h:selectManyCheckbox ?

    How do i get the values (selected or not) of a <h:selectManyCheckbox> tag and show them .For instance
    i have the folowing options :
    <h:selectManyCheckbox
                           id="cartas"
                       layout="pageDirection"
                        value="#{store.cartas}">
          <f:selectItems
                        value="#{cartas}"/>
        </h:selectManyCheckbox>
        <h:message styleClass="validationMessage" for="newsletters"/>with my faces-config.xml:
    <managed-bean>
        <description></description>
        <managed-bean-name>cartas</managed-bean-name>
        <managed-bean-class>java.util.ArrayList</managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
        <list-entries>
          <value-class>javax.faces.model.SelectItem</value-class>
          <value>#{cartas0}</value>
          <value>#{cartas1}</value>
          <value>#{cartas2}</value>
          <value>#{cartas3}</value>
        </list-entries>
      </managed-bean>
      <managed-bean>
        <managed-bean-name>cartas0</managed-bean-name>
        <managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
        <managed-bean-scope>none</managed-bean-scope>
        <managed-property>
          <property-name>label</property-name>
          <value>Semanal</value>
        </managed-property>
        <managed-property>
          <property-name>value</property-name>
          <value>200</value>
        </managed-property>
      </managed-bean>
      <managed-bean>
        <managed-bean-name>cartas1</managed-bean-name>
        <managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
        <managed-bean-scope>none</managed-bean-scope>
        <managed-property>
          <property-name>label</property-name>
          <value>As bruxas</value>
        </managed-property>
        <managed-property>
          <property-name>value</property-name>
          <value>201</value>
        </managed-property>
      </managed-bean>
      <managed-bean>
        <managed-bean-name>cartas2</managed-bean-name>
        <managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
        <managed-bean-scope>none</managed-bean-scope>
        <managed-property>
          <property-name>label</property-name>
          <value>Exercise</value>
        </managed-property>
        <managed-property>
          <property-name>value</property-name>
          <value>202</value>
        </managed-property>
      </managed-bean>
      <managed-bean>
        <managed-bean-name>cartas3</managed-bean-name>
        <managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
        <managed-bean-scope>none</managed-bean-scope>
        <managed-property>
          <property-name>label</property-name>
          <value>Gusman Park</value>
        </managed-property>
        <managed-property>
          <property-name>value</property-name>
          <value>203</value>
        </managed-property>
      </managed-bean>Thanks for the atention!! All the best!!

    Hi,
    In your backing bean you will need to add a new variable to bind your control to, I think this variable needs to be of teh "HtmlSelectManyCheckbox" type. The on your jsp page you can add binding="#{myBean.myVariable}".
    When you want to get the values of the selectMany in your backing bean, you can call the getSelectedValues() function on your HtmlSelectManyCheckbox variable.
    in backing bean:
    private HtmlSelectManyCheckbox hsmc;
    public HtmlSelectManyCheckbox getHsmc(){
        return hsmc;
    public void setHsmc(HtmlSelectManyCheckbox hsmc){
        this.hsmc = hsmc;
    public void someFunction(){
       Object[] obs = hsmc.getSelectedValues();
    }On jsp page:
    <h:selectManyCheckbox
                           id="cartas"
                       layout="pageDirection"
                        value="#{store.cartas}"
                         binding="#(myBean.hsmc}">
          <f:selectItems
                        value="#{cartas}"/>
        </h:selectManyCheckbox>

  • How to get the values of a selectManyCheckBox when that is in h:dataTable

    Hello,
    I have a jsp page. in that user can choose multile checkboxes and these checkboxes labled as Current, Mailing, PosibleMailing, length is 3 fixed.
    And i am displaying this in a <h:dataTable> this datatable length depends upon the users there may be more than 1 user, for every user there is multiplecheckbox with length 3(fixed).
    code is look like this
    <h:dataTable value="#{InvestigationDefendantView.investDefsFindingsModel}" var="def" border="0" >
    <h:column>
    <h:selectManyCheckbox value="#{InvestigationDefendantView.addtype1}" disabled="false">
    <f:selectItem itemValue="Current" itemLabel="Current"/>
    <f:selectItem itemValue="Mailing" itemLabel="Mailing"/>
    <f:selectItem itemValue="Posible" itemLabel="Posible"/>
    <j4j:idProxy id="DefAddTypeProxy"/>
    </h:selectManyCheckbox>
    </h:column>
    </h:dataTable>
    here abovevalue="#{InvestigationDefendantView.investDefsFindingsModel}" suppose 3(we can assume) then there are 3 pairs of selectManyCheckBoxes are there in my jsp page.
    So u can assume in my jsp page checkboxes are look like 3*3 Matrix
    from my backing bean i am fetching the values of this checkboxes with the below code
    java code:
    InvestDefAddressTypeGetter inv = new InvestDefAddressTypeGetter();
    InvestDefAddressTypeBean[] inb = inv.get(pID);
    this.fMap = new HashMap<String, ArrayList<String>>();
    for(int i=0; i<inb.length; i++)
    String str1 = inb.getGivenDefID().toString();
    this.fdefid.add(str1);
    this.fGivenDefID.add(inb[i].getGivenDefID());
    String addType = inb[i].getAddType();
    Logger.info(this, "adding type value", addType);
    this.fdefid.add(str1);
    this.faddType.add(addType);
    Logger.info(this, "length of strings", this.faddType);
    this.fMap.put(str1, this.faddType);
    i am fetching the checkboxes value through my get method
    public String[] getAddtype1() throws SQLException, SearchException
    Logger.info(this, "addtype testing", this.faddType.size());
    if (this.faddType.size() > 0 )
    ArrayList<String> alcb = new ArrayList<String>();
    for (int i = 0; i < this.faddType.size(); i++)
    alcb.add(this.faddType.get(i));
    String[] tempArr = new String[alcb.size()];
    for (int i = 0; i < alcb.size(); i++)
    tempArr[i] = alcb.get(i).intern();
    return tempArr;
    return new String[0];
    from the above code if i have clicked (you can assume 3*3 matrix here) 1*1, 1*2 and 2*1 and 2*2and saving the value in database records are saved as per requirement but when i am editing the records with the above code i am getting 1*1, 1*2 and 2*1, 2*2 and 3*1, 3*2 checked but i did not checked the 3*1 and 3*2 ckeck boxes.
    Because the same get method will be called in the multipleckeck boxes. how can i prevent does not display the unchecked value from my backing bean.
    Please anybody help me in this issue.

    Is this you? [http://forums.sun.com/thread.jspa?threadID=5335038].

  • Problem with binding of a selectManyCheckbox inside a dataTable

    Hi,
    first i want to point out that my english is not the best. :)
    A german version is followed at the end of the english text.
    I have a class "MyClass" with few attributes like:
    private long id;
    private String text;
    private Set<MyClass2> childs;
    An a second class "MyClass2" wich also have some attributes:
    private long id;
    private String text;
    Now i have a List with lots of objects from typ "MyClass":
    List myList = new ArrayList();
    // Sample Data!!
    for (int i=0; i<100; i++)
    MyClass1 m1 = new MyClass1();
    m1.setId(i);
    m1.setText("MyClass1 Line " + i);
    // Now add some "childs":
    for (int j=0; j<i*2; j++)
    MyClass2 m2 = new MyClass2();
    m2.setId( i );
    m2.setText("Sample "+ i);
    m1.getChilds().add(m2);
    myList.add ( m1 );
    So now i want to show the ID and text every Object of MyClass1 on my "test.jsp" (width JSF Tags).
    The Collections inside this class should display as checkboxes (value = id, label = text).
    Sample:
    ID: +1+ TEXT: MyClass1 Line 1
    CHECKBOXES:
    [x] Sample 0
    [x] Sample 1
    ID: +2+ TEXT: MyClass1 Line 2
    CHECKBOXES:
    [x] Sample 0
    [x] Sample 1
    [x] Sample 2
    [x] Sample 3
    Okay i think you know what i mean. ;-)
    I tryed it also with a dataTable to iterate in "myList" and use a selectOneMenu with selectItems to generate the checkboxes.
    Here is the code:
    <h:dataTable value="#{myBean.myList}" var="rowInstance" binding="#{myBean.dataTable}" id="dataTable">
    <h:column>
    <h:outputText value="ID: #{rowInstance.id}" />
    <h:outputText value="TEXT: #{rowInstance.text}" />
    </h:column>
    <h:column>
    <h:selectManyCheckbox id="cbox" styleClass="checkbox">
    <f:selectItems value="#{myBean.childs}"/>
    </h:selectManyCheckbox>
    </h:column>
    </h:dataTable>
    Maybe you see the that i've used childs in the selectItems.
    This is a methode like that:
    public SelectItem[] getChilds()
    MyClass1 mc1 = (MyClass1) dataTable.getRowData();
    // now i iterate the childs and make for each a SelectItem()
    Also you maybe see that i have no binding on selectManyCheckbox, because i have no idea how it works. :-)
    I've tried to bind it to a String[] but and the end this String[] always contain the last low.
    My Question is now:
    When the user pressed the submit Button how can i figure out which Checkboxen the user clicked ?
    Thank you a lot.
    Now the german version (surley better explained):
    Hallo nochmal,
    ich habe versucht auf englisch mein Problem zu schildern.
    Was mit sicherheit nicht zu 100% gelungen ist, deshalb hier noch mal eine deutschsprachige Version (maybe some germans out there).
    Wie oben abgeblidet habe ich im Prinzip zwei Klassen.
    Die erste Klasse "MyClass1" hat eine Collection die Objekte von der Klasse "MyClass2" enth�lt.
    Nun m�chte ich auf meiner JSP Seite die JSF Tags benutzt eine Liste von Objekten (die vom Typ "MyClass1" sind) abbilden.
    Die Collection innerhalb dieser Klasse soll als Checkboxen dargestellt werden.
    Ich habe es ohne gro�e Probleme hinbekommen, dass er das so anzeigt wie ich das m�chte.
    Nur habe ich z.Z. noch Probleme damit wie ich sp�ter herausfinde, welche der Checkboxen denn nun angew�hlt sind.
    Normalerweise w�rde man ja ein binding machen, so k�nnte man alle ausgew�hlten Checkboxen (getSelectedValues()) ja bekommen.
    Da aber die Anzahl der Objekte immer unterschiedlich ist kann ich nicht die entsprechenden Variablen anlegen.
    Deshalb die Frage: Wie bekomme ich mit welche der Checkboxen ausgew�hlt wurden? Wie muss das binding aussehen?
    Vielen Dank.
    Greetings from Germany. :)

    Just bind it to the row object.
    JSF<h:dataTable value="#{myBean.myDataList}" var="myData">
        <h:column>
            <h:selectManyCheckbox value="#{myData.selectedItems}">
                <f:selectItems value="#{myData.selectItems}" />
            </h:selectManyCheckbox>
        </h:column>
    </h:dataTable>MyDataprivate List<String> selectedItems; // + getter + setter
    private List<SelectItem> selectItems; // + getter

  • How to populate default values for SelectManyCheckBox?

    I have this <af:selectManyCheckbox> , which I want to set default value, or later other taskflow will change it's value:
    <af:selectManyCheckbox id="smc4"
    layout="vertical"
    valueChangeListener="#{backingBeanScope.productGroupSelectionBackingBean.lendingSelectionDeselectionListener}"
    autoSubmit="true"
    valuePassThru="true"
    value="#{pageFlowScope.productGroupSelectionHelper.newLendingProduct}">
    <f:selectItems id="si4" value="#{bindings.id.items}"/>
    </af:selectManyCheckbox>
    the selectItems is binding to a list of VO, in which only IDs and label names are saved,both are of type String.
    the newLendingProduct is of type List<SelectItem>.
    During the debugging I found that instead of returning List<SelectItem>, the af:selectManyCheckbox is returning Arrays$ArrayList<object> to me. What is Arrays$ArrayList<object>? After looking into it's value, I found it has an attribute "a", which is an array of String, storing the IDs that are selected.
    I also tried list of string and array of string for newLendingProduct, both can get the return value from page, but cannot set the screen.
    I think I shouldn't use List<SelectItem> to store value of af:selectManyCheckbox, but what should I use?

    U can bind ur value property of af:selectManyCheckbox to ArrayList<String> object
    Step 1.Add property in ur backing bean ArrayList<String> selectedValue = new ArrayList<String>();
    Step 2.Create get and set method for selectedValue
    Step 3. bind this selectedValue to value property ( value="#{backingBeanScope.beanName.selectedValue}" )
    Thanks
    Dinil Mithra V S

  • How to set different color for items in selectManyCheckbox

    hi,
    I would like to change item text background color for each item on selectManyCheckbox (different for each item).
    It is only 5 items so that could be static reference or select.
    I know only how to change background for all items
    af|selectManyCheckbox::item-text {
        background:orange;
    How to select concrete item text and change color for only them?
    I found similar problem:
    css - Set background color of every individual checkbox of p:selectManyCheckbox - Stack Overflow
    but this dont work for me because I dont have in adf tr structure
    I need somethink like this:
    af|selectManyCheckbox::item-text XXXX - select here one of the item by number on list or id  {
        background:orange;

    hi,
    thanks Alejandro and Federico for answers.
    I use JDev 11.1.1.6. I dont write it in previously post because I think that is a more css then adf problem.
    I have 5 selectItem based on simple List<String> {"text1", "text2", "text3", "text4". "text5"}:
    <af:selectManyCheckbox label="List" id="smc2"
                                               layout="horizontal"
                                               value="#{bean.listInBean}"
                                               autoSubmit="true">
                          <af:selectItem label="text1" value="text1" id="si47"/>
                          <af:selectItem label="text2" value="text2" id="si43"/>
                          <af:selectItem label="text3" value="text3" id="si46"/>
                          <af:selectItem label="text4" value="text4" id="si45"/>
                          <af:selectItem label="text5" value="text5" id="si44"/>
                        </af:selectManyCheckbox>
    and I would like to color first selectItem text to orange, second to red.. etc, The list is a static list. Not would be changed.
    After Alejandro answer I build simple for each element (anyCollection contains item with two fields: textValue and label {(text1,text1), (text2,text2)...}
      <af:forEach items="#{bean.anyCollection}"
                                      var="item">
                            <af:selectItem id="si48" value="#{item.textValue}"  styleClass="yourClassName#{var.index}"
                                           label="#{item.label}"/>
                          </af:forEach>
    And now if I have my var called "item" I can write 5 css style classe yourClassName#{var.index} with different color, but there is a problem:
    Attribute styleClass is not defined for af:selectItem
    If it will be so simple I will just add 5 style classes for each selectItem
    <af:selectItem label="text1" value="text1" id="si47" styleClass="yourClassName0"/>
    <af:selectItem label="text2" value="text2" id="si43" styleClass="yourClassName1"/>
    Should I use other component then adf facer rich?

  • How do I preselect a row in Jtable / JScrollPane?

    Hi
    I want to preselect and show a row in a table of e.g. 1000 rows.
    e.g. if I type in a value in a field, I want the table to automatically scroll, and show the row whose 1st column has a value that corresponds closest to what I typed.
    I tried JTable.setRowSelectionInterval(i,j), but this only highlighted the row, and I had to scoll down the scollpane manually to find it.
    Anyone have a suggestion?
    regards
    Arne

    JViewport has a method setViewPosition(p) that takes point p which will be viewport's top left corner. Since u know which row u want to select, getCellRect(row, column) ot JTable gives you cell's Rectangle. Take x and y from this rectangle create a point and use it in setViewPosition. getParent() of JTable directly returns u JViewport. so the code should be
    JTable tabl;
    /* table code
    and finding row and column to be set as r and c;
    Rectangle ret = tabl.getCellRect(r,c,true);
    Point p = new Point(ret.x,ret.y);
    ((JViewport)tabl.getParent()).setViewPosition(p);
    Hope this helps.

  • Is this even possible with a selectManyCheckbox???

    I know I can do one of two layouts with a selectManyCheckbox, line or page. I would like to have the checkboxes go horizontally i.e. line, but after x number of them, say 5, I would like to start a new row rather than scrolling off to the right... I see that a selectManyCheckbox actually renders an HTML table so I tried to use the pass-through attribute "cols" to set it but no dice. Anyone have any idea how to do this or even if it is possible?

    I would say that you would have a device at the dsl first then connect everything else up that is needed. It would have to be wired to the dsl.

  • SelectManyCheckbox event handling

    Hi,
    I am new to this ADF technologies. In my jsp i have a selectmanycheckbox component and have a event handler method in backingbean, when i am clicking on the checkbox the control is going to
    event handler method in backing bean, its fine and working..
    My question is where the control is going or which method is invoking when i am unchecking the same check box ,its not coming to same event handler
    Any help is appreciated...
    Thanks in advance..
    Anoop C

    my jsp code
    <af:selectOneChoice onchange="return fnCheck()"           id="financialYearId" binding="#{acctSummaryBB.financialYears}"
         valueChangeListener="#{acctSummaryBB.getSelectedFinancialYear}"      autoSubmit="true" >
         <f:selectItems binding="#{acctSummaryBB.financialYear}" />
    </af:selectOneChoice>
         <af:selectManyCheckbox id="BU" onclick="selectAllBU()" immediate="true" valuePassThru="true" autoSubmit="true"
    value="#{acctSummaryBB.selectedBUs}" valueChangeListener="#{acctSummaryBB.triggerBU}" >
                   <f:selectItem itemValue="ALL" itemLabel="ALL" />
                   <f:selectItems value="#{acctSummaryBB.allBU}" />
         </af:selectManyCheckbox>
    My BackingBean Code
    public void triggerBU(ValueChangeEvent evt)
    int FY = 0;
    String str = "";
    if (evt != null)
    FacesMessage fm;
    System.out.println("##################### BU CHANGE START####################");
    selectedBUs = ((List)evt.getNewValue());
    System.out.println("##################### SELECTED BU===" + selectedBUs);
    public void getSelectedFinancialYear(ValueChangeEvent event)
    System.out.println("############### START OF FIN YEAR CHANGE METHOD ##################### ");
    Every time control is going to getSelectedFinancialYear() after invoking triggerBU() method when i am checking one item from the SelectManyCheckBox.
    Can anybody provide a solution for this...How can i stop firing ValueChangeEvent from selectOneChoice .
    Plz..Provide a solution.....Thanks..

  • Custom converter for h:selectManyCheckbox, no getAsObject call

    Hello.
    I have a strange problem with my PersonConverter. This converter should convert object of type Person. Implementatin of these classes is not important. So I defined it to faces-config.xml:
    <converter>
      <converter-for-class>x.y.Person</converter-for-class>
      <converter-class>x.y.PersonConverter</converter-class>
    </converter>In my jsp page I have:
    <!-- List<Person> Bean.getSelectedPersons() -->
    <h:selectManyCheckbox id="xyz" value="#{bean.selectedPersons}">
      <!-- List<SelectItem> Bean.getPersons() -->
      <!-- SelectItem oneItem = new SelectItem(person, person[i].getName()) -->
    <f:selectItems value="#{products.persons}"/>
    <h:message for="xyz"/>
    </h:selectManyCheckbox>
    When I access this page I get requested result, eg. checkboxes with names. There are printlns in  getAsString() and getAsObject() so I see that getAsString() was called. However when I submit page I cannot see call to getAsObject() (eg. the println) and on page I get:Conversion Error setting value 'Thomas' for '#{bean.selectedPersons}'. (Assuming that I checked checkbox with label 'Thomas', If I don't check anything, there is '').
    What am I doing wrong please?
    I also tried giving the converter id and adding <f:converter id="personConverterId"/> between h:selectManyCheckbox tags, but it was same.
    Thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thanks for your support.
    I found that #{bean.selectedPersons} evaluated to Set so I added selectedPersonsList property which just creates ArrayList from Set. This is pretty stupid, I'm sorry. Next time I'll look twice before posting.
    By the way, thanks for tutorials on your blog. It helped me a lot with understanding JSF.

  • Custom converter for selectManyCheckbox

    I am having the following problem/general question regarding custom converter and a selectManyCheckbox tag:
    The value property of the selectManyCheckbox tag is referring to a List of Transfer Objects (TO). For this example it is a UserRoleTo, which consists of role id and role description. A List of the SelectItems is used to generate a complete list of roles. Now, I want to convert selected role id�s to UserRoleTOs, and vice versa, but it does not seem to work. What should be the Object returned by getAsObject method: UserRoleTO or SelectItem?
    I would appreciate help and an example.

    This article might provide an interesting read: [http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html]

  • Controlling SelectManyCheckbox layout in ADF Faces

    Hi,
    The only possibilities for the layout for an ADF faces select many checkbox seem to be "horizontal" or "vertical". How can we control the layout to say - have 10 checkboxes laid out horizontally in two groups of 5 vertically laid out checkboxes ?
    If there is no such attribute to control the layout better, does anyone have any recommendations on how this can be accomplished in any alternative way?
    Thank you

    Hi,
    no, but what about using a scrollbar?
    <af:form inlineStyle="width:400px; height:200px; overflow:auto;">
              <af:selectManyCheckbox label="Departments" layout="vertical">
                <af:forEach items="#{bindings.DepartmentsView1.rangeSet}" var="li">
                  <af:selectItem label="#{li.DepartmentName}"
                                 value="#{li.DepartmentId}"/>
                </af:forEach>
              </af:selectManyCheckbox>
            </af:form>Frank

Maybe you are looking for

  • How to get open NAT

    Hello, I have been having trouble with my NAT setting for my PC, I need it to be open. I have googled and tried things all night and still no luck. I have forwarded ports, enabled UPnP.  any ideas? Thanks

  • Error code 2738 when trying to install itunes 8 and quicktime

    I've had itunes installed on my laptop for some time but received a new ipod nano for xmas. When I went on to my current version it said that the nano needed me to upgrade to itunes 8. I downloaded the software but towards the end of the installation

  • Integration of a Tree Structure in a Web Dynpro Table

    Hi, I am implementing an Integration of a Tree Structure in a Web Dynpro Table. The Tree-Table os working as required, but I can not work with the OnLeadSelect Action of the table. The Action does not work as required, meanning, it returns all the ti

  • Strange icon in FCE Timeline

    A bright aqua "pointer" has appeared in my Timeline Ruler (directly over a time indicator during the 46th minute). During playback, when the playhead (Timeline) hits this icon, the clips stops (Audio continues). Playhead continues to next clip which

  • IChat won't go past welcome screen

    When I try to open iChat the "welcome I see this is the first time you have used iChat" screen comes up. And well thats as far as it goes