Components binding in DataTable

Hi I have a dataTable with 2 selectOneMenu and a commandButton in 3 columns, the selectOneMenus and the dataTable are binded in a managed bean, the commandButton call an action method that retrieve the selection from the selectOneMenus and put it in a bean to persist.
If I don't set the "value" attribute it works fine, if I set it just the first row button call the action method (the others doesn't work), why?
Thanks
Demetrio

I found the problem: if I bind in the "value" attribute an Integer field it doesn't work...someone know why?
thanks!
Demetrio Filocamo

Similar Messages

  • Restriction on memory scope for UI components binding

    Hello
    I'm using JDeveloper 11g 10.1.1.3
    I found in the Fusion Developer's Guide for Oracle ADF (14 Getting Started with ADF Task Flows) next thing:
    <i>
    Restrict the scope of the managed bean that you reference through a UI component's binding attribute to backingBean or request scope. Instances of UI components cannot be serialized. Objects in scopes other than backingBean and request are expected to be serializable. For this reason, you should not bind UI components to managed beans that have a scope other than backingBean or request. Note that JDeveloper defaults the binding attribute for UI components and region fragments to use the backingBean scope.
    </i>
    By now I often have binded UI components to the managed beans with pageFlowScope or viewScope, but I have not got problem with that.
    So, question is: what is the case that managedBean with view or pageFlow (even or session) memory scope will be needed to be serialized?
    When could I get the problems with that?
    Anatolii

    For more details you may have a look at section 20.4.3 here:
    http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/web_getstarted.htm#CACCFIII
    http://download.oracle.com/docs/cd/E17904_01/web.1111/b31973/gs_jdev.htm#ADFUI11666
    Dimitar

  • ValueBindingImpl.setValue error on binding for dataTable

    HI,
    I am getting the following error when trying to do a datatable binding.
    I am using WSAD 5.1.2 , JSF 1.0 .
    In the jsp page:
    <h:dataTable id="entitlementsId" value="#{header.entitlementsDummy}" binding="#{header.entitlementsLinksData}" var="entitlement"
                                        border="0" cellspacing="0" cellpadding="0" />In my managed bean code,I am trying to add a dynamic no of columns to the datatable:
    public void setEntitlementsLinksData(HtmlDataTable table) {
              if (table == null) {
                   table = new HtmlDataTable();
                   table.setRendererType(null);
              //TODO: when to clear and when to add
              List tableComponents = table.getChildren();
              tableComponents.clear();
              entitlements = getEntitlements();//Arraylist with String returned
              String var = table.getVar();
              //TODO: check this ??
              table.setValue(entitlements);
              table.setRows(1);
              HtmlOutputText textComponent = null;
              HtmlOutputLink linkComponent = null;
              UIColumn col;
              UIOutput out;
              for (int j = 0; j < 1; j++) {
                   String entitlement = (String) entitlements.get(j);
                   linkComponent = new HtmlOutputLink();
                   linkComponent.setId(var + "link" + j);
                   linkComponent.setValue(entitlement);
                   linkComponent.setStyleClass("navlink");
                   /* create the text label */
                   textComponent = new HtmlOutputText();
                   textComponent.setId(var + "text" + j);
                   textComponent.setValue(entitlement);
                   /* add the label to the link component*/
                   linkComponent.getChildren().add(textComponent);
                   col = new UIColumn();
                   col.setId(var + "col" + j);
                   /*   add the link component to the column */
                   col.getChildren().add(linkComponent);
                   /*   add the column to the table */
                   tableComponents.add(col);
         }Error :
    javax.faces.el.EvaluationException: java.lang.UnsupportedOperationException
         at com.sun.faces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:240)
         at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:491)
         at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:1013)
         at javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1040)
         at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:730)
         at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:423)
         at com.sun.faces.taglib.html_basic.DataTableTag.doStartTag(DataTableTag.java:467)
         at org.apache.jsp._EnterApplicationHeader._jspService(_EnterApplicationHeader.java:229)
         at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    Caused by: java.lang.UnsupportedOperationException
         at java.util.AbstractMap.put(AbstractMap.java:235)
         at com.sun.faces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:158)
         at com.ibm.faces.databind.SelectItemsPropResolver.setValue(SelectItemsPropResolver.java:63)
         at com.ibm.faces.application.SuperPropertyResolver.setValue(SuperPropertyResolver.java:101)
         at com.sun.faces.el.impl.ArraySuffix.setValue(ArraySuffix.java:192)
         at com.sun.faces.el.impl.ComplexValue.setValue(ComplexValue.java:171)
         at com.sun.faces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:212)Thanks,
    Vijay

    A couple of things that might cause the PropertyResolver to break:
    1. Does your 'header' bean and instanceof Map? If so, the PropertyResolver spec says if the bean is a map, take the property (entitlementsLinksData) and 'put' it into the Map for a set, the same thing goes for a 'get' with beans of type Map.
    2. If that's not the case, you can try grabbing a recent snapshot of JSF-RI from https://javaserverfaces.dev.java.net/ which has a complete rewrite of expression handling that fixed a few bugs.

  • How can I validate a DataTable with inputText and other JSF components?

    I have a DataTable with various input components. I need to be able to validate what the user has entered on all the rows of the DataTable. Does anyone have any examples they can point me to, experiences with this, or knowledge on how to do this?
    Thank you so much.

    Do you have to use backing beans instead of managed beans to validate components inside a DataTable?

  • 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

  • Data Table will not bind to Dropdown List selection

    I get the following error when I try to use my own database tables (As in the "Using Databound Components to Access Databases" tutorial). It is a Oracle9i database. The Table (Vehicle)I use to populate the Dropdown List has around 450 000 rows, and the ComponentRowset returns 362 000 rows when run without a parameter.
    Exception Details: javax.faces.el.EvaluationException
    java.lang.NullPointerException
    Possible Source of Error:
    Class Name: com.sun.faces.el.ValueBindingImpl
    File Name: ValueBindingImpl.java
    Method Name: getValue
    Line Number: 206
    Please help! What am I doing wrong? As far as I can see the code is identical to the "Using Databound Components to Access Databases" tutorial.
    Here is the code:
    * Page1.java
    * Created on 12 October 2004, 05:56
    * Copyright jgenis
    package ucodapp;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import com.sun.sql.rowset.*;
    import javax.faces.event.*;
    import javax.faces.convert.*;
    public class Page1 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlDataTable dataTable1 = new HtmlDataTable();
        public HtmlDataTable getDataTable1() {
            return dataTable1;
        public void setDataTable1(HtmlDataTable hdt) {
            this.dataTable1 = hdt;
        private JdbcRowSetXImpl componentRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getComponentRowSet() {
            return componentRowSet;
        public void setComponentRowSet(JdbcRowSetXImpl jrsxi) {
            this.componentRowSet = jrsxi;
        private HtmlOutputLabel componentLabel1 = new HtmlOutputLabel();
        public HtmlOutputLabel getComponentLabel1() {
            return componentLabel1;
        public void setComponentLabel1(HtmlOutputLabel hol) {
            this.componentLabel1 = hol;
        private HtmlOutputText componentLabel1Text = new HtmlOutputText();
        public HtmlOutputText getComponentLabel1Text() {
            return componentLabel1Text;
        public void setComponentLabel1Text(HtmlOutputText hot) {
            this.componentLabel1Text = hot;
        private UIColumn column1 = new UIColumn();
        public UIColumn getColumn1() {
            return column1;
        public void setColumn1(UIColumn uic) {
            this.column1 = uic;
        private HtmlOutputText outputText1 = new HtmlOutputText();
        public HtmlOutputText getOutputText1() {
            return outputText1;
        public void setOutputText1(HtmlOutputText hot) {
            this.outputText1 = hot;
        private HtmlOutputText outputText2 = new HtmlOutputText();
        public HtmlOutputText getOutputText2() {
            return outputText2;
        public void setOutputText2(HtmlOutputText hot) {
            this.outputText2 = hot;
        private UIColumn column2 = new UIColumn();
        public UIColumn getColumn2() {
            return column2;
        public void setColumn2(UIColumn uic) {
            this.column2 = uic;
        private HtmlOutputText outputText3 = new HtmlOutputText();
        public HtmlOutputText getOutputText3() {
            return outputText3;
        public void setOutputText3(HtmlOutputText hot) {
            this.outputText3 = hot;
        private HtmlOutputText outputText4 = new HtmlOutputText();
        public HtmlOutputText getOutputText4() {
            return outputText4;
        public void setOutputText4(HtmlOutputText hot) {
            this.outputText4 = hot;
        private UIColumn column3 = new UIColumn();
        public UIColumn getColumn3() {
            return column3;
        public void setColumn3(UIColumn uic) {
            this.column3 = uic;
        private HtmlOutputText outputText5 = new HtmlOutputText();
        public HtmlOutputText getOutputText5() {
            return outputText5;
        public void setOutputText5(HtmlOutputText hot) {
            this.outputText5 = hot;
        private HtmlOutputText outputText6 = new HtmlOutputText();
        public HtmlOutputText getOutputText6() {
            return outputText6;
        public void setOutputText6(HtmlOutputText hot) {
            this.outputText6 = hot;
        private UIColumn column4 = new UIColumn();
        public UIColumn getColumn4() {
            return column4;
        public void setColumn4(UIColumn uic) {
            this.column4 = uic;
        private HtmlOutputText outputText7 = new HtmlOutputText();
        public HtmlOutputText getOutputText7() {
            return outputText7;
        public void setOutputText7(HtmlOutputText hot) {
            this.outputText7 = hot;
        private HtmlOutputText outputText8 = new HtmlOutputText();
        public HtmlOutputText getOutputText8() {
            return outputText8;
        public void setOutputText8(HtmlOutputText hot) {
            this.outputText8 = hot;
        private UIColumn column5 = new UIColumn();
        public UIColumn getColumn5() {
            return column5;
        public void setColumn5(UIColumn uic) {
            this.column5 = uic;
        private HtmlOutputText outputText9 = new HtmlOutputText();
        public HtmlOutputText getOutputText9() {
            return outputText9;
        public void setOutputText9(HtmlOutputText hot) {
            this.outputText9 = hot;
        private HtmlOutputText outputText10 = new HtmlOutputText();
        public HtmlOutputText getOutputText10() {
            return outputText10;
        public void setOutputText10(HtmlOutputText hot) {
            this.outputText10 = hot;
        private UIColumn column6 = new UIColumn();
        public UIColumn getColumn6() {
            return column6;
        public void setColumn6(UIColumn uic) {
            this.column6 = uic;
        private HtmlOutputText outputText11 = new HtmlOutputText();
        public HtmlOutputText getOutputText11() {
            return outputText11;
        public void setOutputText11(HtmlOutputText hot) {
            this.outputText11 = hot;
        private HtmlOutputText outputText12 = new HtmlOutputText();
        public HtmlOutputText getOutputText12() {
            return outputText12;
        public void setOutputText12(HtmlOutputText hot) {
            this.outputText12 = hot;
        private UIColumn column7 = new UIColumn();
        public UIColumn getColumn7() {
            return column7;
        public void setColumn7(UIColumn uic) {
            this.column7 = uic;
        private HtmlOutputText outputText13 = new HtmlOutputText();
        public HtmlOutputText getOutputText13() {
            return outputText13;
        public void setOutputText13(HtmlOutputText hot) {
            this.outputText13 = hot;
        private HtmlOutputText outputText14 = new HtmlOutputText();
        public HtmlOutputText getOutputText14() {
            return outputText14;
        public void setOutputText14(HtmlOutputText hot) {
            this.outputText14 = hot;
        private RowSetDataModel dataTable1Model = new RowSetDataModel();
        public RowSetDataModel getDataTable1Model() {
            return dataTable1Model;
        public void setDataTable1Model(RowSetDataModel rsdm) {
            this.dataTable1Model = rsdm;
        private HtmlSelectOneMenu dropdown1 = new HtmlSelectOneMenu();
        public HtmlSelectOneMenu getDropdown1() {
            return dropdown1;
        public void setDropdown1(HtmlSelectOneMenu hsom) {
            this.dropdown1 = hsom;
        private UISelectItems dropdown1SelectItems = new UISelectItems();
        public UISelectItems getDropdown1SelectItems() {
            return dropdown1SelectItems;
        public void setDropdown1SelectItems(UISelectItems uisi) {
            this.dropdown1SelectItems = uisi;
        private JdbcRowSetXImpl vehicleRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getVehicleRowSet() {
            return vehicleRowSet;
        public void setVehicleRowSet(JdbcRowSetXImpl jrsxi) {
            this.vehicleRowSet = jrsxi;
        private BigDecimalConverter dropdown1Converter = new BigDecimalConverter();
        public BigDecimalConverter getDropdown1Converter() {
            return dropdown1Converter;
        public void setDropdown1Converter(BigDecimalConverter bdc) {
            this.dropdown1Converter = bdc;
        // </editor-fold>
        public Page1() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                componentRowSet.setDataSourceName("java:comp/env/jdbc/CDS");
                componentRowSet.setCommand("SELECT ALL TRACKER.COMPONENT.PINNO, TRACKER.COMPONENT.UNITCODE, TRACKER.COMPONENT.INSTALLEDDATE, TRACKER.COMPONENT.INSTALLREPORTNO, TRACKER.COMPONENT.TNUSERIALNO, TRACKER.VEHICLE.REGNO, TRACKER.VEHICLE.VINNO, TRACKER.VEHICLE.VEHICLEID, TRACKER.TRACKERAGREEMENT.TAID, TRACKER.TAPRODUCT.TAPRODUCTID, TRACKER.COMPONENT.COMPONENTID, TRACKER.COMPONENT.TAPRODUCTID, TRACKER.COMPONENT.COMPONENTTYPEID, TRACKER.COMPONENT.INSTALLERID, TRACKER.TAPRODUCT.TAID, TRACKER.TAPRODUCT.PRODUCTTYPEID, TRACKER.TAPRODUCT.TAPRODUCTSTATUSID, TRACKER.TAPRODUCT.PRORATANRDAYS, TRACKER.TAPRODUCT.CONTRACTPERIOD, TRACKER.TAPRODUCT.BILLINGFREQUENCYID, TRACKER.TAPRODUCT.CANCELLATIONDATE, TRACKER.TAPRODUCT.STARTDATE, TRACKER.TAPRODUCT.SOURCEID, TRACKER.TAPRODUCT.PRICINGDATE, TRACKER.TAPRODUCT.DEALTYPEID, TRACKER.TAPRODUCT.ACTIONTYPEID, TRACKER.TAPRODUCT.ISSTANDARDBATTERY, TRACKER.TAPRODUCT.AUDITUSERID, TRACKER.TAPRODUCT.AUDITSRID, TRACKER.COMPONENT.SERIALNUMBER, TRACKER.COMPONENT.RECEIVEDDATE, TRACKER.COMPONENT.RESPONSECODE, TRACKER.COMPONENT.REPLYCODE, TRACKER.COMPONENT.ACTIVATIONCODE, TRACKER.COMPONENT.ALERT, TRACKER.COMPONENT.ALTDEACTIVATIONCODE, TRACKER.COMPONENT.INSTALLEDLOCATION, TRACKER.COMPONENT.VERSION, TRACKER.COMPONENT.SOFTWAREVERSION, TRACKER.COMPONENT.CANACTIVATE, TRACKER.COMPONENT.COMPONENTSTATUSID, TRACKER.COMPONENT.SIMNO, TRACKER.COMPONENT.LOCATECELLNO, TRACKER.COMPONENT.AUDITDT, TRACKER.COMPONENT.THEFTNO, TRACKER.TAPRODUCT.STATUSBEFORECANCELLATION, TRACKER.TAPRODUCT.AUDITDT, TRACKER.TRACKERAGREEMENT.VEHICLEID, TRACKER.TRACKERAGREEMENT.CUSTOMERID, TRACKER.TRACKERAGREEMENT.TASTATUSDATE, TRACKER.TRACKERAGREEMENT.TASTATUSID, TRACKER.TRACKERAGREEMENT.AUDITUSERID, TRACKER.TRACKERAGREEMENT.AUDITSRID, TRACKER.TRACKERAGREEMENT.AUDITDT, TRACKER.VEHICLE.MAKEMODELID, TRACKER.VEHICLE.VEHICLECOLOURID, TRACKER.VEHICLE.COLOURSHADEID, TRACKER.VEHICLE.BATTERYID, TRACKER.VEHICLE.INSURERID, TRACKER.VEHICLE.ENGINENO, TRACKER.VEHICLE.CHASSISNO, TRACKER.VEHICLE.POLICYNO, TRACKER.VEHICLE.YEARMODEL, TRACKER.VEHICLE.JOINDATE, TRACKER.VEHICLE.POLICYCOMMENCEDATE, TRACKER.VEHICLE.DESCRIPTION, TRACKER.VEHICLE.ACTIVE, TRACKER.VEHICLE.METALLICIND, TRACKER.VEHICLE.TEMPREGNO, TRACKER.VEHICLE.ORDERNUMBER, TRACKER.VEHICLE.POLICYSEQUENCENO, TRACKER.VEHICLE.AUDITUSERID, TRACKER.VEHICLE.AUDITSRID, TRACKER.VEHICLE.AUDITDT, TRACKER.VEHICLE.THEFTNO  FROM TRACKER.COMPONENT INNER JOIN TRACKER.TAPRODUCT ON TRACKER.COMPONENT.TAPRODUCTID=TRACKER.TAPRODUCT.TAPRODUCTID INNER JOIN TRACKER.TRACKERAGREEMENT ON TRACKER.TAPRODUCT.TAID=TRACKER.TRACKERAGREEMENT.TAID INNER JOIN TRACKER.VEHICLE ON TRACKER.TRACKERAGREEMENT.VEHICLEID=TRACKER.VEHICLE.VEHICLEID WHERE TRACKER.VEHICLE.VEHICLEID=?");
                dataTable1Model.setDataCacheKey("com.sun.datacache.Page1.componentRowSet");
                dataTable1Model.setRowSet(componentRowSet);
                dataTable1Model.setSchemaName("");
                dataTable1Model.setTableName("");
                vehicleRowSet.setDataSourceName("java:comp/env/jdbc/CDS");
                vehicleRowSet.setCommand("SELECT ALL TRACKER.VEHICLE.VEHICLEID, TRACKER.VEHICLE.REGNO  FROM TRACKER.VEHICLE");
                vehicleRowSet.setFetchSize(1000);
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
            // Initialization Code
            // Part of the Using Databound Components to Access Databases Tutorial
            // You can find this tutorial on the web -- use the link on the Welcome page
            try {
                vehicleRowSet.execute();
                vehicleRowSet.next();
                dataTable1Model.setObject(1, vehicleRowSet.getObject("VEHICLEID"));
            } catch (Exception ex) {
                throw new FacesException(ex);
            } // end try catch
        protected ucodapp.ApplicationBean1 getApplicationBean1() {
            return (ucodapp.ApplicationBean1)getBean("ApplicationBean1");
        protected ucodapp.SessionBean1 getSessionBean1() {
            return (ucodapp.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
            vehicleRowSet.close();
            vehicleRowSet.close();
            componentRowSet.close();
        public void dropdown1_processValueChange(ValueChangeEvent vce) {
            // Dropdown List Event Code
            // Part of the Using Databound Components to Access Databases Tutorial
            // You can find this tutorial on the web -- use the link on the Welcome page
            try {
                dataTable1Model.setObject(1, dropdown1.getValue());
                dataTable1Model.execute();
            } catch (Exception e) {
                log("vehicle id change exception", e);
                error("Exception changing Vehicle Id: " + e);
            } // end try catch
            // User event code here...

    Take a look at the Page1 constructor.
    It appears that you're trying to bind the datatable to 2
    different rowsets. I suggest to clean up this
    constructor to make sure you're using the right
    rowset.
    Your value binding expressions on each column
    of the datatable may not be set to the right column.
    John
    JSC QA

  • SelectOneMenu inside h:dataTable gives conversion error

    Hi guys,
    I'm enduring quite alot of misery attempting to put selectOneMenu UI components in my h:dataTable. Due to the 30000 character restriction, I can only submit my view and backing bean and DTO and the converter (even though the total characters of my files is only 26,583? [cat * | wc -c]). Perhaps you can figure out a way I can send me all my files and you'll be able to test it much easier.
    The jist of the problem is that I get a conversion error between the selectOneMenu and the backing DTO of the <h:dataTable>. After I define a converter I get a ClassCastException.
    My BIGGEST question is "Why do I even need a converter?", the selectItem(s)/options are hardcoded label/value Strings and so is the the property of the dataTable row's backing DTO!!!
    Here's the files, any assistance will be greatly appreciated.
    P.S. I'm running JDeveloper 10.1.3.3.
    Thanks.
    (All these files are in the same package so you can just put them all in a directory named "example"):
    My DTO BudgetEquipmentListVO.java:
    package example;
    import java.util.Date;
    import java.util.List;
    public class BudgetEquipmentListVO {
        private Integer rowNo = new Integer("0");               //Row number for paging thru dataTables.
        private String equipmentListId = new String("0");                        //From equipment_list table.
        private Integer equipmentCodeId = new Integer("0");         //From equipment_codes table
        private String objectCode = "0730";                     //So far, 0730,0735 are possible.
        private Integer budgetId = new Integer("0");            //fed_budget_id from fed_budget table.
        private String  description = "";
        private String  equipNo = "";                           //Alphanumeric
        private Date    dateAcquired = new Date();  
        private Integer estimatedCost = new Integer("0");       //Used for Stimulus Application
        private Integer actualCost = new Integer("0");          //Used for EOY expenditures.  Disable for stimulus application
        private String  bldgLocation = "";                      //Address where equipment is at.
        private String  approvedInd = "N";                      //Whether item's been approved or not. Y/N
        private Integer amountApproved = new Integer("0");      //Gets set on approval page.
        private StringBuffer comment = new StringBuffer(4000);  //Currently max 4000 chars
        private String  suppInstInd = "I";            //Support or Instruction item, S or I
        private Integer approvedById = new Integer("0");        //User id of approver.
        private Date    approvedDate = null;                    //Date approved
        private List<BudgetEquipmentListVO> innerList;
        public BudgetEquipmentListVO() {
        public void setObjectCode(String objectCode) {
            this.objectCode = objectCode;
        public String getObjectCode() {
            return objectCode;
        public void setBudgetId(Integer budgetId) {
            this.budgetId = budgetId;
        public Integer getBudgetId() {
            return budgetId;
        public void setDescription(String description) {
            this.description = description;
        public String getDescription() {
            return description;
        public void setEquipNo(String equipNo) {
            this.equipNo = equipNo;
        public String getEquipNo() {
            return equipNo;
        public void setDateAcquired(Date dateAcquired) {
            this.dateAcquired = dateAcquired;
        public Date getDateAcquired() {
            return dateAcquired;
        public void setEstimatedCost(Integer estimatedCost) {
            this.estimatedCost = estimatedCost;
        public Integer getEstimatedCost() {
            return estimatedCost;
        public void setActualCost(Integer actualCost) {
            this.actualCost = actualCost;
        public Integer getActualCost() {
            return actualCost;
        public void setBldgLocation(String bldgLocation) {
            this.bldgLocation = bldgLocation;
        public String getBldgLocation() {
            return bldgLocation;
        public void setApprovedInd(String approvedInd) {
            this.approvedInd = approvedInd;
        public String getApprovedInd() {
            return approvedInd;
        public void setAmountApproved(Integer amountApproved) {
            this.amountApproved = amountApproved;
        public Integer getAmountApproved() {
            return amountApproved;
        public void setComment(StringBuffer comment) {
            this.comment = comment;
        public StringBuffer getComment() {
            return comment;
        public void setSuppInstInd(String suppInstInd) {
            this.suppInstInd = suppInstInd;
        public String getSuppInstInd() {
            return suppInstInd;
        public void setApprovedById(Integer approvedBy) {
            this.approvedById = approvedBy;
        public Integer getApprovedById() {
            return approvedById;
        public void setApprovedDate(Date approvedDate) {
            this.approvedDate = approvedDate;
        public Date getApprovedDate() {
            return approvedDate;
        public void setRowNo(Integer rowNo) {
            this.rowNo = rowNo;
        public Integer getRowNo() {
            return rowNo;
        // Helpers ------------------------------------------------------------------------------------
         // Getters ------------------------------------------------------------------------------------
         public String getKey() {
             return equipmentListId;
         public BudgetEquipmentListVO getValue() {
             return this;
        // This must return true for another Foo object with same key/id.
        public boolean equals(Object other) {
            return other instanceof BudgetEquipmentListVO && equipmentListId != null && equipmentListId.equals(((BudgetEquipmentListVO) other).getEquipmentListId());
        // This must return the same hashcode for every Foo object with the same key.
        public int hashCode() {
            return equipmentListId != null ? this.getClass().hashCode() + equipmentListId.hashCode() : super.hashCode();
        // Override Object#toString() so that it returns a human readable String representation.
        // It is not required by the Converter or so, it just pleases the reading in the logs.
        public String toString() {
            return "BudgetEquipmentListVO[" + equipmentListId.toString() + ", " + equipmentCodeId.toString() + ", " + objectCode + ", " + approvedInd + ", " + suppInstInd + "]";
        public void setEquipmentListId(String equipmentListId) {
            this.equipmentListId = equipmentListId;
        public String getEquipmentListId() {
            return equipmentListId;
        public void setEquipmentCodeId(Integer equipmentCodeId) {
            this.equipmentCodeId = equipmentCodeId;
        public Integer getEquipmentCodeId() {
            return equipmentCodeId;
        public void setInnerList(List<BudgetEquipmentListVO> innerList) {
            this.innerList = innerList;
        public List<BudgetEquipmentListVO> getInnerList() {
            return innerList;
    The View, equipmentList.jspx:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces"
              xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
      <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
                  doctype-system="http://www.w3.org/TR/html4/loose.dtd"
                  doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
      <jsp:directive.page contentType="text/html;charset=windows-1252"/>
      <f:view>
      <f:loadBundle basename="myBundle" var="myBundle"/>
        <afh:html>
          <afh:head title="ARRA - Equipment List (0730, 0735)">
            <meta http-equiv="Content-Type"
                  content="text/html; charset=windows-1252"/>
            <link rel="stylesheet" type="text/css" href="/css/crud.css" />
            <script type="text/javascript" src="/js/global.js"></script>
          </afh:head>
          <afh:body>
            <h:form id="equipmentForm">
              <afh:tableLayout width="100%">
                <afh:rowLayout width="100%" halign="center">
                  <afh:cellFormat columnSpan="1" width="100%" halign="center"
                                  rowSpan="1">
                    <h:dataTable value="#{backing_equipmentScreen.dataList}"
                                 binding="#{backing_equipmentScreen.dataTable}"
                                 styleClass="dataTable" rowClasses="rowOdd,rowEven"
                                 var="dataItem" id="table" border="2"
                                 bgcolor="#C2DFFF" width="100%"
                                 rows="#{backing_equipmentScreen.numItems}">
                    <f:facet name="header">
                        <af:outputText value="#{myBundle.headerTable}"
                                       inlineStyle="font-size:small;"/>
                      </f:facet>
                        <h:column>
                            <f:facet name="header">
                                <af:outputText value="#{myBundle.headerColumnRowNumber}"
                                         inlineStyle="font-size:small;"/>
                            </f:facet>
                            <af:outputText value="#{backing_equipmentScreen.dataTable.rowIndex + 1}"
                                       inlineStyle="font-size:small;"/>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnDesc}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:outputText value="#{dataItem.description}"/>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnEquipNo}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:inputText value="#{dataItem.equipNo}"
                                           />
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnDateAcquired}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <af:selectInputDate value="#{dataItem.dateAcquired}"/>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnObjCode}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:selectOneMenu value="#{dataItem.objectCode}" binding="#{backing_equipmentScreen.objCodeMenu}">
                                <f:selectItem id="item1" itemLabel="0730" itemValue="0730"/>
                                <f:selectItem id="item2" itemLabel="0735" itemValue="0735"/>
                                <f:converter converterId="selectOneMenuConverter"/>
                              </h:selectOneMenu>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnInsSuppInd}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:selectOneMenu value="#{dataItem.suppInstInd}" binding="#{backing_equipmentScreen.suppInstMenu}">>
                                <f:selectItem id="supportitem1" itemLabel="Support" itemValue="S"/>
                                <f:selectItem id="supportitem2" itemLabel="Instruction" itemValue="I"/>
                              </h:selectOneMenu>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnEstCost}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:inputText value="#{dataItem.estimatedCost}">
                              <f:convertNumber
                                                currencySymbol="$"
                                                groupingUsed="#{true}"
                                                maxFractionDigits="0"
                                                type="currency"/>
                              </h:inputText>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnActualCost}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:inputText value="#{dataItem.actualCost}">
                              <f:convertNumber
                                                currencySymbol="$"
                                                groupingUsed="#{true}"
                                                maxFractionDigits="0"
                                                type="currency"/>
                              </h:inputText>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnBldgLoc}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:inputTextarea value="#{dataItem.bldgLocation}"/>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnApprovedInd}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:selectOneMenu value="#{dataItem.approvedInd}" binding="#{backing_equipmentScreen.yesNoMenu}">>
                                <f:selectItem id="yesnoitem1" itemLabel="Yes" itemValue="Y"/>
                                <f:selectItem id="yesnoitem2" itemLabel="No" itemValue="N"/>
                              </h:selectOneMenu>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                      <h:column>
                        <f:facet name="header">
                          <h:panelGroup>
                            <afh:rowLayout>
                              <afh:cellFormat inlineStyle="font-size:small;">
                                <h:outputText value="#{myBundle.headerColumnComments}"/>
                              </afh:cellFormat>
                            </afh:rowLayout>
                          </h:panelGroup>
                        </f:facet>
                        <h:panelGroup>
                          <afh:rowLayout>
                            <afh:cellFormat inlineStyle="font-size:small;">
                              <h:inputTextarea value="#{dataItem.comment}"/>
                            </afh:cellFormat>
                          </afh:rowLayout>
                        </h:panelGroup>
                      </h:column>
                        <f:facet name="footer">
                            <h:panelGrid columns="4">
                                <h:outputLabel for="rows" value="#{myBundle.labelRowsPage}:" />
                                <h:panelGroup>
                                    <h:inputText id="rows" value="#{backing_equipmentScreen.dataTable.rows}" styleClass="input" size="1"><f:validateLongRange minimum="1" maximum="100" /></h:inputText>
                                    <h:commandButton value="#{myBundle.buttonSet}" action="#{backing_equipmentScreen.pageFirst}" styleClass="input" />
                                </h:panelGroup>
                                <h:outputText value="#{myBundle.labelPaging}:" />
                                <h:panelGroup>
                                    <h:commandButton value="#{myBundle.buttonFirst}" action="#{backing_equipmentScreen.pageFirst}" styleClass="input" disabled="#{backing_equipmentScreen.dataTable.first == 0}" />
                                    <h:commandButton value="#{myBundle.buttonPrevious}" action="#{backing_equipmentScreen.pagePrevious}" styleClass="input" disabled="#{backing_equipmentScreen.dataTable.first == 0}" />
                                    <h:commandButton value="#{myBundle.buttonNext}" action="#{backing_equipmentScreen.pageNext}" styleClass="input" disabled="#{backing_equipmentScreen.dataTable.first + backing_equipmentScreen.dataTable.rows >= backing_equipmentScreen.dataTable.rowCount}" />
                                    <h:commandButton value="#{myBundle.buttonLast}" action="#{backing_equipmentScreen.pageLast}" styleClass="input" disabled="#{backing_equipmentScreen.dataTable.first + backing_equipmentScreen.dataTable.rows >= backing_equipmentScreen.dataTable.rowCount}" />
                                    <h:outputText value="#{myBundle.labelPage}: #{backing_equipmentScreen.currentPage} / #{backing_equipmentScreen.totalPages}" />
                                </h:panelGroup>
                                <h:outputLabel for="add" value="#{myBundle.labelAddRows}:" />
                                <h:panelGroup>
                                    <h:inputText id="add" value="#{backing_equipmentScreen.addCount}" styleClass="input" size="1"><f:validateLongRange minimum="1" maximum="100" /></h:inputText>
                            <af:commandButton action="#{backing_equipmentScreen.actionAdd}"
                                              styleClass="input"
                                              text="#{myBundle.buttonAdd}"/>
                          </h:panelGroup>
                                <h:outputText value="#{myBundle.labelActions}:" />
                                <h:panelGroup>
                                    <h:commandButton value="#{myBundle.buttonSelectAll}" action="#{backing_equipmentScreen.actionSelectAll}" rendered="#{!backing_equipmentScreen.editMode and !backing_equipmentScreen.selectAll}" styleClass="input" />
                                    <h:commandButton value="#{myBundle.buttonUnselectAll}" action="#{backing_equipmentScreen.actionSelectAll}" rendered="#{!backing_equipmentScreen.editMode and backing_equipmentScreen.selectAll}" styleClass="input" />
                                    <h:commandButton value="#{myBundle.buttonEdit}" action="#{backing_equipmentScreen.actionEdit}" rendered="#{!backing_equipmentScreen.editMode}" styleClass="input" />
                                    <h:commandButton value="#{myBundle.buttonDelete}" action="#{backing_equipmentScreen.actionDelete}" rendered="#{!backing_equipmentScreen.editMode}" styleClass="input" />
                                    <h:commandButton id="save" value="#{myBundle.buttonSave}" action="#{backing_equipmentScreen.actionSave}" rendered="#{backing_equipmentScreen.editMode}" styleClass="input" />
                                    <h:commandButton value="#{myBundle.buttonRefresh}" action="#{backing_equipmentScreen.actionRefresh}" immediate="true" styleClass="input" />
                                    <h:commandButton value="#{myBundle.buttonReset}" action="#{backing_equipmentScreen.actionReset}" immediate="true" styleClass="input" />
                                </h:panelGroup>
                            </h:panelGrid>
                        </f:facet>
                    </h:dataTable>
                    <h:panelGroup rendered="#{empty backing_equipmentScreen.dataList and !backing_equipmentScreen.message}">
                        <h:panelGroup rendered="#{!backing_equipmentScreen.searchMode}">
                            <h:outputText value="#{myBundle.textNoData}" />
                            <h:commandButton value="#{myBundle.buttonAdd}" action="#{backing_equipmentScreen.actionAdd}" styleClass="input" />
                        </h:panelGroup>
                        <h:outputText value="#{myBundle.textRefineSearch}" rendered="#{backing_equipmentScreen.searchMode}" />
                    </h:panelGroup>
                    <h:panelGroup rendered="#{backing_equipmentScreen.message}">
                        <h:outputText value="#{myBundle.textErrors}" styleClass="error" />
                        <h:messages styleClass="error" />
                    </h:panelGroup>
                  </afh:cellFormat>
                </afh:rowLayout>
              </afh:tableLayout>
            </h:form>
          </afh:body>
        </afh:html>
      </f:view>
    </jsp:root>

    Hi evryone,
    I have following piece of code
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <af:messages/>
    <af:form>
    <af:selectOneChoice>
    <f:selectItem itemLabel="ABC" itemValue="ABC"/>
    <f:selectItem itemLabel="DEF" itemValue="DEF"/>
    <f:selectItem itemLabel="GHI" itemValue="GHI"/>
    <f:selectItem itemLabel="JKL" itemValue="JKL"/>
    <f:selectItem itemLabel="MNO" itemValue="MNO"/>
    </af:selectOneChoice>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    When I run this program , I get following compiler error:
    Error(12): Unable to convert constant to type javax.el.ValueExpression for attribute "itemLabel" of tag "selectItem".
    Error(12): Unable to convert constant to type javax.el.ValueExpression for attribute "itemValue" of tag "selectItem".
    Error(13): Unable to convert constant to type javax.el.ValueExpression for attribute "itemLabel" of tag "selectItem".
    Error(13): Unable to convert constant to type javax.el.ValueExpression for attribute "itemValue" of tag "selectItem".
    Error(14): Unable to convert constant to type javax.el.ValueExpression for attribute "itemLabel" of tag "selectItem".
    Error(14): Unable to convert constant to type javax.el.ValueExpression for attribute "itemValue" of tag "selectItem".
    Error(15): Unable to convert constant to type javax.el.ValueExpression for attribute "itemLabel" of tag "selectItem".
    Error(15): Unable to convert constant to type javax.el.ValueExpression for attribute "itemValue" of tag "selectItem".
    Error(16): Unable to convert constant to type javax.el.ValueExpression for attribute "itemLabel" of tag "selectItem".
    Error(16): Unable to convert constant to type javax.el.ValueExpression for attribute "itemValue" of tag "selectItem".
    Anyone has any ideas? Where could be problem?

  • Comboboxes are not set  on the 1st time a row is clicked in the dataTable

    I have somewhat the following setup:
    I have a DataTable that is filled with a listof objects, a actionListener is handeled when a row is clicked.
    Under the Table there are two ComboBoxes (lets call them Category and Item) that get their values from lists of Objects. The values of the list that backs the Item combo depend on the selected value of the Category combo.
    Lets assume the values look like this:
    CategoryA
    ---ItemA1
    ---ItemA2
    CategoryB
    ---ItemB1
    ---ItemB2
    Together with some textboxes, they should represent the values of the clicked row in the Table.
    Now the problem:
    When the comboboxes have a different value than the row that is be&iuml;ng selected the values of the comboboxes and textboxes are not set correctly until the 3rd time the row is clicked.
    It also doesn't go into the onClickMehod in the backing bean before the 3rd click. This is checked by a logger.
    an example:
    before clicking, the category combo is set to "CategoryB", the Item combo is set to "ItemB1" and the textboxes are empty. The row that is going to be clicked has as its category "CategoryA" and as its Item "ItemA1"
    1st click:
    the form still shows the values like they were before clicking, the log doesn't show that the method is triggered
    2nd click:
    the Item combo is set to "ItemA1", the category is still set to "CategoryB", the textBoxes are still empty. The log still doesn't show that the method is triggered
    3rd click:
    the Category combo is set to "CategoryA", the Item combo is set to "ItemA1", the textboxes also have their correct values.
    the code is as followed:
    JSP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head></head>
    <body>
    <f:view>
    <h:form binding="#{backingBean.pageLoad}">
    <h:dataTable binding="#{backingBean.dataTable}" columnClasses="COL1, COL1, COL2, COL2, COL3" value="#{backingBean.myObjects}" var="myObject" width="100%" headerClass="HEADING" rowClasses="ROW1, ROW2" rows="10">
    <h:column>
    <f:facet name="header">
    <h:commandLink actionListener="#{backingBean.sortDataList}" styleClass="rowHeader">
    <f:attribute name="sortField" value="getItemCategory" />
    <h:outputText value="Category"/>
    </h:commandLink>
    </f:facet>
    <h:commandLink shape="rect" styleClass="rowtext" value="#{myObject.item.itemCategory.description}" actionListener="#{backingBean.rowSelect}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:commandLink actionListener="#{backingBean.sortDataList}" styleClass="rowHeader">
    <f:attribute name="sortField" value="getItem" />
    <h:outputText value="Item"/>
    </h:commandLink>
    </f:facet>
    <h:commandLink shape="rect" styleClass="rowtext" value="#{myObject.item.name}" actionListener="#{backingBean.rowSelect}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:commandLink actionListener="#{backingBean.sortDataList}" styleClass="rowHeader">
    <f:attribute name="sortField" value="getDescription" />
    <h:outputText value="Certification"/>
    </h:commandLink>
    </f:facet>
    <h:commandLink shape="rect" styleClass="rowtext" value="#{myObject.description}" actionListener="#{myObject.description}"/>
    </h:column>
    <f:facet name="footer">
    <h:panelGroup style="text-align:right">
    <h:commandButton value="first" action="#{backingBean.pageFirst}" disabled="#{backingBean.dataTable.first == 0}" />
    <h:commandButton value="prev" action="#{backingBean.pagePrevious}" disabled="#{backingBean.dataTable.first == 0}" />
    <h:commandButton value="next" action="#{backingBean.pageNext}" disabled="#{backingBean.dataTable.first + backingBean.dataTable.rows >= backingBean.dataTable.rowCount}" />
    <h:commandButton value="last" action="#{backingBean.pageLast}" disabled="#{backingBean.dataTable.first + backingBean.dataTable.rows >= backingBean.dataTable.rowCount}" />
    <h:commandButton value="Append New" action="#{backingBean.ClearFields}" />
    </h:panelGroup>
    </f:facet>
    </h:dataTable>
    <h:inputHidden value="#{backingBean.sortField}"/>
    <h:inputHidden value="#{backingBean.sortAscending}"/>
    <h:inputHidden value="#{backingBean.myObjectId}"/>
    <br />
    <br />
    <table style="border-collapse: collapse; width:100%" cellpadding="3" border="1">
    <tr>
    <td style="text-align:left; width:20%; background-image:url('images/lbar.gif'); font-family:Arial; font-size:smaller; font-weight:bold" colspan="3">Detail</td>
    </tr>
    <tr>
    <td style="text-align:right; width:20%; background-color:#CCCCCC; font-family:Arial; font-size:smaller; font-weight:bold">Category </td>
    <td style="width:80%; background-color:#CCCCCC;font-weight:bold">
    <h:selectOneMenu value="#{backingBean.selectedCategory}" onchange="submit();" valueChangeListener="#{backingBean.CategoryChange}">
    <f:selectItems value="#{backingBean.selectedCategories}"/>
    </h:selectOneMenu>
    </td>
    </tr>
    <tr>
    <td style="text-align:right; width:20%; background-color:#CCCCCC; font-family:Arial; font-size:smaller; font-weight:bold">Item id </td>
    <td style="width:80%; background-color:#CCCCCC;font-weight:bold">
    <h:selectOneMenu value="#{backingBean.selectedItem}">
    <f:selectItems value="#{backingBean.selectedItems}"/>
    </h:selectOneMenu>
    </td>
    </tr>
    <tr>
    <td style="text-align:right; width:20%; background-color:#CCCCCC; font-family:Arial; font-size:smaller; font-weight:bold">Item Description </td>
    <td style="width:80%; background-color:#CCCCCC;font-weight:bold"> <h:inputTextarea value="#{backingBean.description}" cols="60" rows="5"/></td>
    </tr>
    </table>
    </h:form>
    </f:view>
    </body>
    </html>the backing bean:
    public class BackingBean{
    -- Declaration of properties --
    public void rowSelect(ActionEvent event) {
    // Get selected MyData item to be edited.
    logger.debug("Select row");
    FacesContext context = FacesContext.getCurrentInstance();
    try
    if ((sortField != null) && (myObjects != null)) {
    Collections.sort(myObjects, new DTOComparator(sortField, sortAscending));
    dataTable.saveState(context);
    catch(Exception e){
    logger.error(e.getLocalizedMessage(), e);
    context.addMessage("ERROR", new FacesMessage(e.toString()));}
    logger.debug("Setting fields");
    myObject = (MyObject) dataTable.getRowData();
    description = myObject.getDescription();
    itemCategory = myObject.getItem().getItemCategory();
    item = myObject.getItem();
    docDisabled = !certified;
    selectedCategory = itemCategory.getId();
    myObjectId = myObject.getId();
    logger.debug("Fields set");
    public void sortDataList(ActionEvent event) {
    String sortFieldAttribute = getAttribute(event, "sortField");
    // Get and set sort field and sort order.
    if (sortField != null && sortField.equals(sortFieldAttribute)) {
    sortAscending = !sortAscending;
    } else {
    sortField = sortFieldAttribute;
    sortAscending = true;
    // Sort results.
    if (sortField != null) {
    Collections.sort(myObjects, new DTOComparator(sortField, sortAscending));
    public void CategoryChange(ValueChangeEvent vce){
    try {
    logger.debug("SelectedIndexChange: Category: {}",vce.getNewValue().toString());
    selectedCategory = Integer.parseInt(vce.getNewValue().toString());
    logger.debug("SelectedIndexChange: Category");
    itemCategory = itemCategoryService.retrieveItemCategoryById(selectedCategory);
    logger.debug("Showing Category: {}", itemCategory.getDescription());
    } catch (Exception e) {
    logger.error("Error occured: {}",e.toString());
    FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage("ERROR", new FacesMessage(e.toString()));
    public List<SelectItem> getSelectedItems() {
    selectedItems = new ArrayList<SelectItem>();
    try
    logger.debug("selectedCategory: {}",selectedCategory);
    if (itemCategory!=null)
    logger.debug("Category Object: {}",itemCategory.getId());
    items.clear();
    items.addAll(itemCategoryService.retrieveItemCategoryById(selectedCategory).getItems());
    logger.debug("items recieved: {}",items.size());
    for (int count = 0; count < items.size(); count++) {
    selectedItems.add(new SelectItem(items.get(count).getSeq(),items.get(count).getName()));
    catch (Exception e){
    logger.error("Error occured: {}",e.toString());
    FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage("ERROR", new FacesMessage(e.toString()));
    return selectedItems;
    public List<SelectItem> getSelectedCategories() {
    selectedCategories = new ArrayList<SelectItem>();
    try{
    for (int count = 0; count < itemCategories.size(); count++) {
    if (itemCategories.get(count).getItems().size() != 0)
    selectedCategories.add(new SelectItem(itemCategories.get(count).getId(),itemCategories.get(count).getDescription()));
    if (selectedCategory == 0)
    selectedCategory = itemCategories.get(0).getId();
    catch (Exception e){
    logger.error("Error occured: {}",e.toString());
    FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage("ERROR", new FacesMessage(e.toString()));
    return selectedCategories;
    -- other getters and setters --
    }I've already tried to use the action attribute instead of the actionlistener attribute, also tried to add immediate="true" to all fields and columns.
    Did try to add onclick="submit();" to the rows.
    What can be done to fix it??
    ps: the enviroment is JSF + Spring + Hibernate

    The <h:messages/> tag is where the validation exception is shown, but no validation is used on the form, no other exeptions are sown.
    the List<Categories> is filled at a setPageLoad method which is bound to the form by <h:form binding="#{backingBean.pageLoad}">.
    The List<SelectedItem> of the categories box is filled in its getter and filled with the values of the List<Categories>
    And both the List<SelectedItem> of the items box and the List<Item> are filled in the getter of the List<SelectedItem> of the items box
    so instead of that i should rewrite it to something like this:
    public BackingBean() {
        selectedCategories = new List<SelectedItem>();
        selectedItems = new List<SelectedItem>();
        categories = CategoryService.retrieveCategories(); //gets all categories
        items = ItemService.retrieveItemsByCategory(selectedCategory); //gets the items
        for (int count = 0; count < categories.size(); count++) {
            selectedCategories.add(new SelectItem(categories.get(count).getId(),categories.get(count).getDescription()));
        if (selectedCategory == 0){
            selectedCategory = categories.get(0).getId();
        for (int count = 0; count < items.size(); count++) {
            selectedItems.add(new SelectItem(items.get(count).getId(),items.get(count).getDescription()));
        if (selectedItem == 0){
            selectedItem = items.get(0).getId();
    public void CategoryChange(ValueChangeEvent vce){
            try {
                if (vce.getPhaseId() != PhaseId.INVOKE_APPLICATION) {
                    vce.setPhaseId(PhaseId.INVOKE_APPLICATION);
                    vce.queue();
                } else {
                    FacesContext.getCurrentInstance().renderResponse();
                    selectedCategory = Integer.parseInt(vce.getNewValue().toString());
                    category = CategoryService.retrieveCategoryById(selectedCategory); // gets the category Object
            } catch (Exception e) {
                logger.error("Error occured: {}",e.toString());
                FacesContext context = FacesContext.getCurrentInstance();
                context.addMessage("ERROR", new FacesMessage(e.toString()));
    public List<SelectItem> getSelectedCategories() {
        return selectedCategories;
    public void setSelectedCategories(List<SelectItem> selectedCategories) {
        this.selectedCategories = selectedCategories;
    public List<SelectItem> getSelectedItems() {
        return selectedCategories;
    public void setSelectedItems(List<SelectItem> selectedItems) {
        this.selectedItems = selectedItems;
    }The bean is request scoped.

  • Flash components & XML

    Hi all,
    I am working on a new project that I can't seem to find any
    help resources for. I am using the Flash Components, binding and
    schemas to link together text fields, drop downs(ComboBox), and a
    button to the XML Connector. The part I can't figure out is if
    there is a way to make the button dynamically change it's
    destination URL when the subject of the dropdown(ComboBox
    component) is changed. In the XML file, I have nodes for all the
    components to accept. Is there any way for the Component button to
    accept the different <URL> nodes as I change the parent node
    with the drop down box? I thought maybe a variable or an instance
    name in the XML Connector or Button Component bindings or schema
    area could work. But no luck yet. Thanks in advance.

    huh! I'v tried searching for that phrase exactly & have
    had few matching results!! How did you do that?? Thats magic that
    is! Thanks alot! (Found one on the first result!)

  • To find the "column value"  when clicked on Dynamic datatable

    I ahve done a dynamic table where the first row alone i ahve declared as command link.So when I click on the commadn link I need to get either column name or column count or rowdata.If I Get then I have some logic based on it to do.
    I have placed my dynamic datatable code below.
    public class Datatable2 extends PageCodeBase
    UIData dataTable =new UIData();
    public Datatable2()
    UIColumn col;
    UIOutput out = null;
    ArrayList al=new ArrayList();
    al.add("Item");
    al.add("Creation date");
    al.add("Priority");
    Application app = FacesContext.getCurrentInstance().getApplication();
    int colCount = 3;
    for(int j = 0; j < colCount; ++j) {
    out = new UIOutput();
    col = new UIColumn();
    if(dataTable.getRowIndex()==-1)
    MethodBinding mb = app.createMethodBinding("#{pc_DataTable.item}", null);
    HtmlCommandLink link = (HtmlCommandLink)app.createComponent(HtmlCommandLink.COMPONENT_TYPE);                     link.setActionListener(mb);
    link.setAction(mb);
    link.setId("Command"+j);
    ValueBinding vb1 = app.createValueBinding("#{commands" + j + "}");
    link.setValueBinding("value",vb1);
    link.setRendererType("javax.faces.Link");
    HtmlOutputText O = new HtmlOutputText();
    O.setValue(al.get(j).toString());
    link.getChildren().add(O);
    col.setHeader(link);   
    ValueBinding vb = app.createValueBinding("#{rows["+j+"]}");
    out.setValueBinding("value", vb);
    out.setRendererType("javax.faces.Text");
    col.getChildren().add(out);
    dataTable.getChildren().add(col);
    public UIData getDataTable()
         return dataTable;
    public void setDataTable(UIData dataTable)
    this.dataTable=dataTable;
    public Object[] getTableRows()
    Object[] test = new Object[]{new String[]{"1","2","3"},
    new String[]{"4","5","6"},
    new String[]{"7","8","9"},
    new String[]{"10","11","12"},
    new String[]{"13","14","15"}};
    return test;
    this is my jsp code
    <f:view>
    <P>Place content here.</P>
    <h:form>
    <h:dataTable binding="#{pc_Datatable2.dataTable}" value="#{pc_Datatable2.tableRows}" var= "rows" />
    </h:form>
    </f:view>
    Could please tell how can i figure out my coulmn value when clicked on the command link

    hello,
    u can use two types methods  u can create a dynamic action or by branching using conditional or java script code
    for java script code just call the code when button clicked and in javascript function by using if condition u can redirect.
    Regards,
    Ramana

  • How to create a column with increasing numbers in h:dataTable?

    I need to make a table that would have a column with order numbers, starting from 1 and increasing by 1 for every row. I tried using JSTL for this but it seems it is being ignored (as it probably should). My code is below. I know I am supposed to use getRowIndex() with bound tables, by my table isn't bound to anything...
    I could hold the number in the backing bean but that seems like a total overkill.
    Is there a proper way to this in JSF? Could I maybe somehow reference this (meaning tha table itself) within the EL expression?
    <c:set var="month" value="0" />
    <h:dataTable value="#{loansManager.rates}" var="rate">
                <c:set var="month" value="${month+1}" />
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Month" />
              </f:facet>
              <c:out value="${month}" />
         </h:column>
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Rate" />
              </f:facet>
              <h:outputText value="#{rate}" />
         </h:column>
    </h:dataTable>

    Bind the datatable to the backing bean and use HtmlDataTable#getRowIndex().
    You can find here an example: [http://balusc.blogspot.com/2006/06/using-datatables.html#AddRowNumbers].

  • Data binding and screen communication

    It seems to me that the "backing bean" concept for a view is becoming the common way to implement JSF pages. I just wanted to get some feedback on something I was thinking about concerning the data that the components bind to and communication between screens. I think there are two options:
    1) Create a "ViewDataBean" more or less a "sister-bean" to the backing bean, and is stored in session scope. All of the components in the backing bean are bound to the data in the ViewDataBean. That ViewDataBean would also be used to communicate from one screen to the other (binding related pages to the ViewDataBean attributes).
    2) Eliminate the "ViewDataBean" and put the actual data in the backing bean itself, binding the components in the backing bean to the data. Communication between screens would then be done by binding components in one backing bean to the data in a different backing bean. This means that all backing beans would be in session scope and I would need to figure out a way to clean them up. Other than that I think this would be a good solution.
    I asked this same question during the "Q&A" portion of the "Meet the JSF Expert group", and didn't get a lot of feedback. What do you guys think of this?
    Dave

    I beleive Adam Winer just said there are some problems in using session beans.
    That why many experts will say: "keep session storage to a reasonable minimum."
    Inside "blueprints solutions" you can find rules:
    Request scope
    Information in this scope is created some time after the request is received and is disposed of some time before the response is complete. It is a good practice to have the backing beans for pages be in the request scope where possible, and maintain separate beans that store only the information that will not need to be continually passed between the client and server.
    The following types of information are good candidates for storing in the request scope:
    Value bindings (e.g. <h:inputText value="#{MyBean.lastName}" /> should always be stored in request scope since they are automatically restored on every request.
    Component bindings (e.g. <h:inputText binding="#{MyBean.lastNameComponent}" />) should always be stored in request scope since their value is no longer valid after a request has been processed anyway. The component tree is reconstituted during each incoming request, changing the physical instances these component bindings will point to.
    References to database resources such as connections, statements, and result sets should be properly closed and discarded before a request is complete (see the section on resource management below for details).<>
    <>Caches of database query results - see section on caching database query results for details.
    <>Temporary results of calculations used for rendering the current view.
    Session scope
    Information in this scope is created some time after the current user's first request is received and is disposed of after a configurable period of inactivity (i.e. when a request has not been received in a certain period of time), or when a session is explicitly invalidated by the application. It is also disposed of when the application is undeployed. Depending on the robustness of the application server, it may also be disposed of when the application server is shut down or crashes.
    The following types of information are good candidates for storing in the session scope:
    Navigational context, for example the album the user is currently editing in a music catalog application. This type of information could potentially be carefully passed back and forth via hidden input fields, but this is error prone and can be difficult to manage together with form validation and when forms are shared between different parts of an application.
    Information that is specific to this session, but temporary, such as short-lived shopping carts. The information can be made persistent by also updating a database table. The recommended way to do this is via entity EJBs, but this can be done by manually coding database-aware JavaBeans as well.
    Security sensitive information that should not be continuously sent back and forth between the client and server.
    Caches of database query results - see section on caching database query results for details.
    Application scope
    Information in this scope is created some time after the application starts and is discarded some time before the application is undeployed. Depending on the robustness of the application server, it may also be disposed of when the application server is shut down or crashes.
    The following types of information are good candidates for storing in the application scope:
    Information that transcends particular users or sessions, such as application settings.
    Caches of database query results - see section on caching database query results for detai
    I'm sure we just have to make real JSF application, not some kind of jsp or html pages.
    Rules for creating real JSF application:
    1) using only native JSF navigation
    2) using only JSF tags
    3) easy way to exchange information between beans
    (probably suggestion Adam Winer about input and output parameters for action is good idea in this direction)
    4) using only good jsf components
    In good JSF application using session scope can't be problem at all.

  • Command link from nested datatables

    I have nested datatables that work, but I need to be able execute an actionListener from a h:commandLink and reference the item that is being clicked. The example below works except that it always returns the items in the last category. So that if the 2nd item in the first category is clicked, the 2nd item of the last category is returned. I tried binding my dataTables to UIData objects on my managed bean so that I could call getRowData() but I cannot find a way to bind the embedded h:dataTable when I don't know how many to expect.
    Here is the code (stripped down for simplicity):
    <h:dataTable value="#{bean.categories}" var="category">
        <h:column>
            <h:outputText value="#{category.name}" styleClass="txtTitle"/>
            <h:dataTable value="#{category.items}" var="item">
                <h:column>
                    <h:commandLink actionListener="#{bean.activate}">
                        <h:outputText value="#{item.name}"/>
                        <f:param name="activate" value="#{item}"/>
                    </h:commandLink>
                </h:column>
            </h:dataTable>
        </h:column>
    </h:dataTable>
    =====================================================
    public class ManagedBean {
        private List categories;
        private Item activeItem;
        public void activate(ActionEvent e) {
            UICommand command = (UICommand)e.getComponent();
            List children = command.getChildren();
            for (Iterator i = children.iterator(); i.hasNext(); ) {
                UIComponent child = (UIComponent) i.next();
                if (child instanceof UIParameter) {
                    UIParameter param = (UIParameter)child;
                    if (param.getName().equals("activate")) {
                        this.activeItem = (Item)param.getValue();
                        break;
        public List getCategories() {
            return categories;
        public void setCategories(List categories) {
                this.categories = categories;
        public Item getActiveItem() {
            return activeItem;
        public void setActiveItem(item activeItem) {
                this.activeItem = activeItem;
    }

    bump

  • Selecting a row of h:datatable with java

    hello
    Is there any way to set selected row in java bean for h:datatable ?
    in other words.
    how can I select a row of h:datatable with java ?
    regards

    If you have an UICommand component in a row, there are two ways:
    Bind h:dataTable to an UIData property in backing bean and use UIData#getRowData().
    Or wrap data list in an DataModel instance and use DataModel#getRowData().
    Alternatively you could also use f:setPropertyActionListener, but that isn't that efficient inside a h:dataTable.
    If you actually want to select rows using radiobuttons or checkboxes, then check the examples in this article: [http://balusc.blogspot.com/2006/06/using-datatables.html].

  • Displaying detail data after clicking the link in h:dataTable

    Hi All,
    I have following requirement.
    h:dataTable displays the list of addressList like my homeAddressList workAddressList and so on. As soon as I click on one of these I need to display list of all addresses shown in this list. My problem is how to identify in the jsf bean which link was clicked.
    I use hibernate for persisitense and hence directly iterate over hibernate transient domain object collection to display the list. For e.g User has AddressList
    Any help. Thanks in advance.

    Bind the datatable to a HtmlDataTable (or UIData) property in the bean and use HtmlDataTable#getRowData() to obtain the row object associated with the UICommand action.
    Also see this article for examples (and much more): [http://balusc.blogspot.com/2006/06/using-datatables.html].

Maybe you are looking for

  • Mid 2010 Unresponsive

    MacBook Pro Mid 2010 (MacBookPro 6.2) 2.53 GHz Intel Core i5 4 GB 1067 MHz DDR 3 OS X 10.8.5 Mountain Lion Hitachi 500 GB SATA. This machine has worked flawlessly for years. I have about 60GB of data on the drive and backup regularly. Suddenly it has

  • Communication issue btw applications on SAP J2EE Engine6.20 & Websphere 6.0

    We have a customized SAP IPC application running on SAP J2EE Engine 6.20 and it is communicating with another application called Common Configurator or C2 running on WebSphere 4.0.5. Communication between customized SAP IPC application and C2 applica

  • Blank line in MSCONFIG connected to error 148:3?

    Install any Adobe CS4 product on a Windows OS and the software adds some number of Startup items to MSCONFIG including CS4ServiceManager, AdobeCollabSync and a blank line with no Startup file name or Command Line entry. Until Adobe's products added t

  • I am afraid to install Firefox 6.0 because it says it will disable my AVG virus protection.

    when i go to install Firefox 6.0 i am told that my AVG Safesearch will be disabled.

  • MacBook not booting after RAM upgrade

    I'm sorry if the case has been already posted. Yesterday I took my MacBook Alu unibody late 2008 to a RAM upgrade (from 2 to 4gigs) to an offical Mac Reseller. They installed it and showed me that the system loads properly and recognized the new RAM.