PanelGrid component binding problem

I have a panelGrid that is bound to an object in my backing bean. When the page loads the panelGrid is empty. When the user clicks on a button it is suppose to populate the panelGrid. But the panelGrid doesn't render after clicking the button. Here is my code:
jsp
<div style="margin-left:30px;">
             <div>
                 <ice:outputText value="Click 'Run Diagnostics' to begin tests." />
             </div>
             <div style="margin-left:20px;padding-bottom:40px;">
                 <ice:commandButton value="Run Diagnostics"
                                     action="#{SystemDiagnostics.runDiagnostics_clicked}"/>
                 <ice:outputText value="#{SystemDiagnostics.resultsText}"/>
             </div>
             <div>
                 <ice:outputText style="font-decoration:underline;"
                                 value="Diagnostics" />
             </div>
             <div style="margin-left:20px;">
                 <ice:panelGrid binding="#{SystemDiagnostics.diagnosticsPanelGrid}" >
                      <!--Dynamic values go here -->
                 </ice:panelGrid>
             </div>
         </div> bean
public void runDiagnostics_clicked() {
         PdlgCommandCollectionResult result = Pdlg.instanceOf().runDiagnostics();
             if (result.isSuccessful()) {
                 HtmlPanelGrid grid = new HtmlPanelGrid();
                 grid.setColumns(2);
                 HtmlOutputText output = new HtmlOutputText();
                 output.setValue("Boot Disk");
                 grid.getChildren().add(output);
                 output = new HtmlOutputText();
                 output.setValue("Success");
                 grid.getChildren().add(output);
                 setDiagnosticsPanelGrid(grid);
     public HtmlPanelGrid getDiagnosticsPanelGrid() {
         return m_diagnosticsPanelGrid;
     public void setDiagnosticsPanelGrid(HtmlPanelGrid value) {
         m_diagnosticsPanelGrid = value;
     }Does anyone know why this is not rendering?
Thanks,
David

Well, I discovered how to resolve this.
The component that you bind to can not be recreated in the backing bean. Only the components within the bound component can be recreated. So what i did was added a panelGroup and binded that to my backing bean and then was able to recreate the panelGrid that was a child of the panelGroup.

Similar Messages

  • ADFPhaseListener prepareRender and component binding problem

    I´m Using ADF Faces and using the ADFPhaseListener. My BackingBean extends from the PageController class
    and so can use prepareModel(LifecycleContext context) or prepareRender(LifecycleContext context). This works fine so far. The
    event handler methods are called as expected (in my example prepareRender). But I have one question.
    I´m using Component binding in my JSF-Page:
    <af:inputText binding="#{backing_untitled1.inputText1}" id="inputText1">
    Code snippet from my ControllerClass
    public class Untitled1 extends PageController{
    CoreInputText inputText1;
    public void setInputText1(CoreInputText inputText1) {   
    System.out.println("setInputText1");
    this.inputText1 = inputText1;
    public void prepareRender(LifecycleContext context) {
    super.prepareRender(context);
    System.out.println("inside prepareRender");
    I´ve written a second PhaseListener that just print´s out the JSF lifecycle phase numbers for better tracing.
    The first time I call my JSF-Page the following output is generated:
    07/01/03 08:32:38 Before Phase: 1 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:32:38 After Phase: 1
    07/01/03 08:32:38 inside prepareRender
    07/01/03 08:32:38 Before Phase: 6 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:32:39 setInputText1
    07/01/03 08:32:40 After Phase: 6
    I can see that the prepareRender is called before phase 6. The component binding is done in phase 6. What I would like to
    do is access the component binding in my prepareRender method. But this is not possible as it is null before phase 6.
    Is there a way to create event handling code after the component binding has taken place?
    When I do a postback (second call to the same JSF page) this thing changes
    07/01/03 08:37:23 Before Phase: 1 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:37:24 setInputText1
    07/01/03 08:37:24 After Phase: 1
    07/01/03 08:37:24 Before Phase: 2 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:37:24 After Phase: 2
    07/01/03 08:37:24 Before Phase: 3 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:37:24 After Phase: 3
    07/01/03 08:37:24 Before Phase: 4 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:37:24 After Phase: 4
    07/01/03 08:37:24 Before Phase: 5 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:37:24 After Phase: 5
    07/01/03 08:37:24 inside prepareRender
    07/01/03 08:37:24 Before Phase: 6 Source:com.sun.faces.lifecycle.LifecycleImpl@163
    07/01/03 08:37:24 After Phase: 6
    Here in my prepareRender method I could access the component binding as it has been initialized in phase 1.
    Thanks in advance
    Rainer

    hi, you can use this way to initially a value:
    public void setInputText1(CoreInputText inputText1) {
    this.inputText1 = inputText1;
    if( !AdfFacesContext.getCurrentInstance().isPostback() ){
    this.inputText1.setValue("somevalue");
    in the RenderModel phase is not possible set value to a component because this one is null, as you have said.. by this way you can do this too:
    public void setInputText1(CoreInputText inputText1) {
    this.inputText1 = inputText1;
    if( !AdfFacesContext.getCurrentInstance().isPostback() ){
    DCIteratorBinding ib = (DCIteratorBinding)Utilidades.resolveExpression("#{bindings.BanksView1Iterator}");
    RowIterator iter = ib.getRowSetIterator();
    Row row = iter.first();
    if (row != null){
    this.inputText1.setValue(row.getAttribute(BanksViewRowImpl.COD));}
    }

  • Component binding property problem

    following problem:
    I have a form where I built a dataTable with a dynamic number of columns. To achieve this, I used a component binding (backing bean) to dynamically add columns.
    The form is used for different kind of queries and every query has it's own number of columns. The query-identification is submitted via a request parameter.
    All the data in the query-form are o.k. (bean values) but the backing bean will not be called in case of a new request (same jsf-form, but other request-parameter).
    example:
    http://host/url.faces?id=1
    http://host/url.faces?id=2
    <h:dataTable id="test"
                 value="#{test.values}"
                 var="i"
                 rendered="true"
                 binding="#{test.table}">
    </h:dataTable>whereas test is a bean which is created in a servlet listener and also updated with the corresponding id from the request.
    The table-property depends on the id given in the request.
    why ?

    ok, I found out, that using the <h:commandLink> with a param-tag solves this issue.
    Now the backing-bean's method to build the table is all-time called.
    And it works even after an expired session.
    But unfortunately I do not really know, why it works this way and the other it doesn't...

  • JClient Component Binding Demo

    Hi,
    I've a question about the JClient Component Binding Demo.
    If I look at the JUNavbar/JUStatusBar binding demo, and the Panel Binding pane,
    I see NO way how to add a new Line Item if the Order doesn't have already one.
    I understand that the problem is because no one of the Line Item entry fields gets the focus.
    What was your intention on how to add a row in an emty table?
    Thanks

    One way folks on OTN reported they've worked around this issue is to add an combo implementing iterator picker on the NavBar. Then when they end up in this situation, the users can select the right iterator and add rows to it by binding the navbar to that iterator (which is not focus-able due to no rows in it in a table display).
    Another way I would suggest is to trap a mouse-click event on the table and if clicked upon, make the navbar focus on the iterator that the table was bound to.

  • PanelGrid component behavior - initialization

    I have a behavior that I do not understand.
    I have a page that has several components including a 'gridPanel' and a 'pageFragment' with a javascript date slection menu. On the page fragment, I have an 'OK' button that initiates a display sequence within the 'gridPanel'. The display sequence is in a separate session bean and consists of creating a set of components within the 'gridPanel'.
    Here is what I can do.
    1) Navigate to the page.
    2) Push the 'OK' button.
    3) The 'OK' button returns null and the page passes through the prerender code for a second time and calls the display code in the session bean.
    4) The display is drawn as expected.
    Here is what I want to do, but cannot.
    1) Navigate to the page.
    2) In the 'prerender()' method, do something that will call the display sequence in the session bean. without having to push the OK button.
    Basically, I want the display to come up when the page is navigated to, without having to push another button to generatre another redisplay.
    When I attempt to call the display sequence in the session bean directly, the components that are used are null.
    Here is the layout for the 'gridPanel' in the page
    <h:panelGrid binding="#{OverviewPage.tsOverviewPanel}" id="tsOverviewPanel">
         <ui:panelLayout binding="#{OverviewPage.titlePanel1}" id="titlePanel1">
              <h:panelGrid binding="#{OverviewBean.titleGrid}" >
         </ui:panelLayout>
         <ui:panelLayout binding="#{OverviewPage.summaryPanel1}" id="summaryPanel1" >
              <h:panelGrid binding="#{OverviewBean.summaryGrid}" id="summaryGrid"/>
              <h:panelGrid binding="#{OverviewBean.errorGrid}" id="errorGrid"/>
         </ui:panelLayout>
    </h:panelGrid>
    The main panelGrid component 'tsOverviewPanel' belongs to the page 'OverviewPage'. It contains two additional panels that belong to the page "OverviewPage". These panels contain one or two panelGrid components that belong to the session bean 'OverviewBean'.
    When I attempt to draw directly from the prerender() method of the page 'OverviewPage" the components that belong to the session bean 'OverviewBean" are null, however, the session bean is not. Once I push the 'OK" button it apparently submits the page to be redrawn in the JSF context and the components get initialized
    What I suspect is happening is that I am getting messed up with the display phases of JSF.
    When I attempt to draw directly from the prerender() method, the components belonging to the session bean 'OverviewBean" have not been instantiated, even though the 'init()' method of the session bean is being called, based on my logging.
    Does anyone know how I can get the necessary components to initiate in this phase?
    I do not have the option of moving everything into the page itself.
    Thanks.

    Well, I discovered how to resolve this.
    The component that you bind to can not be recreated in the backing bean. Only the components within the bound component can be recreated. So what i did was added a panelGroup and binded that to my backing bean and then was able to recreate the panelGrid that was a child of the panelGroup.

  • Component binding table

    Hi,
    can someone give me an example of component binding with dataTable?
    In my app i must use this, because i don't know number of columns - so i must make table in my java code. Each column consists of checkbox and inputText and under the table is submit button which submits entire table. Values of checkbox and inputText in one column are bind to BackBean (this bean has selected value and price value).
    In my jsp, i use something like this:
    <h:dataTable var="table" binding="#{model.table}" value="#{model.data}" />
    I'm working on this for a week and I stil don't know how to do it.
    Thanks in advance,
    jarin

    Hi,
    yes U understand my problem. I have in my jsp only:
    <h:dataTable binding="#{model.table}"/>
    <h:commandButton action="#{model.set} value="submit"/>
    I use client state saving,
    model is managed bean ModelBean in request scope
    my two classes, which do all work - they should work if you get them into any app, I removed any unnecessary pieces of code:
    /* class ModelBean -------------------------------*/
    package backing.divadlo;
    import backing.divadlo.SedadloBack;
    import javax.faces.component.html.*;
    import java.util.*;
    import javax.faces.el.ValueBinding;
    import javax.faces.context.FacesContext;
    import javax.faces.component.*;
    public class ModelBean  {
      private UIData table;
      private ArrayList data;
      private int colNumber, rowNumber;
      public ModelBean() {
        table = new UIData();
        data = new ArrayList();
        colNumber = 0;
        rowNumber = 0;
      public void setData(ArrayList d) {
        this.data = d;
      public ArrayList getData() {
        return this.data;
      public void setTable(UIData tbl) {
        this.table = tbl;
      public UIData getTable() {
        init(); // normaly I call init() in another bean, if I select which auditorium will be shown
        return this.table;
      public void pripravData() {
        data.clear();
        // prepair of auditorium - get rows and number of cols
        rowNumber = 2;  // after all works, here will be rows of auditorium
        colNumber = 20; // seats in row, each row can have another number of seats
        // loop trough rows of auditorium
        for (int i = 0; i < rowNumber; i++) {
          ArrayList novaRada = new ArrayList();  // new row with seats
          // insert seats (SedadloBack) into new row
          for (int k = 0; k < colNumber; k++) {
            SedadloBack sedB = new SedadloBack(); // new seat
            sedB.setRada(k);      // set number of row
            sedB.setSedadlo(k);   // set number of seat
            sedB.setProdej(true); // is free or not
            sedB.setPrice(k);     // set price
            // insert seat into new row
            novaRada.add(sedB);
          // insert new row into auditorium
          data.add(novaRada);
      public void init() {
        FacesContext context = FacesContext.getCurrentInstance();
        List list = table.getChildren();
        list.clear();
        pripravData();
        if(data != null) {
          table.setValue(data);
          table.setRows(data.size());
          table.setRowIndex(0);
          table.setVar("dTable");
          UIColumn column;
          HtmlInputText priceText;
          HtmlSelectBooleanCheckbox checkbox;
          HtmlOutputText br1,br2,cislo;
          for (int i = 0; i < colNumber; i++) {
            column = new UIColumn();                    // new column
            priceText = new HtmlInputText();            // input for price
            checkbox = new HtmlSelectBooleanCheckbox(); // is free or not
            br1 = new HtmlOutputText();                 // <br>
            br2 = new HtmlOutputText();                 // <br>
            cislo = new HtmlOutputText();               // position of seat in row
            br1.setValue(new String("<br />"));
            br2.setValue(new String("<br />"));
            br2.setEscape(false);
            br1.setEscape(false);
            // prepare outText of position in row
            String cisloExp = "#{"+table.getVar()+"["+i+"].sedadlo}";
            ValueBinding vbCislo = context.getApplication().createValueBinding(cisloExp);
            cislo.setValueBinding("value",vbCislo);
            // prepare checkbox - if seat is free or not
            String expCheckbox = "#{"+table.getVar()+"["+i+"].prodej}";
            ValueBinding vbCheckbox = context.getApplication().createValueBinding(expCheckbox);
            checkbox.setValueBinding("value",vbCheckbox);
            // prepare inputText - price of seat
            priceText.setTitle("Cena");
            priceText.setStyleClass("cenaInput");
            String vbSIn = "#{"+table.getVar()+"["+i+"].price}";
            ValueBinding vbI = context.getApplication().createValueBinding(vbSIn);
            priceText.setValueBinding("value", vbI);
            // prepare column
            column.getChildren().add(cislo);
            column.getChildren().add(br1);
            column.getChildren().add(priceText);
            column.getChildren().add(br2);
            column.getChildren().add(checkbox);
            list.add(column);
      public String set() {
        // for now just print out price with position of seat
        for(int j=0; j < table.getRowCount(); j++) {
          table.setRowIndex(j);
          if(table.isRowAvailable()) {
            ArrayList data = (ArrayList)table.getRowData();
            for(int i=0; i < data.size(); i++) {
              SedadloBack sedadlo = (SedadloBack)data.get(i);
              System.out.println(sedadlo.getRada()+"/"+sedadlo.getSedadlo()
                                 +" - "+sedadlo.getPrice());
        return "null";
    /* class SedadloBack -------------------------------*/
    package backing.divadlo;
    import java.io.Serializable;
    public class SedadloBack implements Serializable {
      private int id;
      private int rada;
      private int sedadlo;
      private int price;
      private boolean prodej;
      public void setId(int id) {
        this.id = id;
      public int getId() {
        return this.id;
      public void setRada(int rada) {
        this.rada = rada;
      public int getRada() {
        return this.rada;
      public void setSedadlo(int sedadlo) {
        this.sedadlo = sedadlo;
      public int getSedadlo() {
        return this.sedadlo;
      public void setProdej(boolean pr) {
        this.prodej = pr;
      public boolean getProdej() {
        return this.prodej;
      public void setPrice(int price) {
        this.price = price;
      public int getPrice() {
        return this.price;
    } I realy appreciate your help, this is my first app in jsf - i make it as my dissertation and I am starting be little late.
    If you need more info or code i give you what you want. Preparing war is little complicated - I use postgres and hibernate and i doubt if you want install this db only to test my case.
    jarin

  • If I consider heap size, should I follow component binding or Value binding

    Hi,
    I have an Web application my pages gets change rapidly in run time(components get disable and invisible at run-time depends on user input), So in that case which kind of binding approach I have to follow if I consider Heap memory of run time.

    navaneeth.j wrote:
    I am getting more grip on the component means, in ValueChange event I can get the updated value in the backing bean, That means on the updated values of the rest of the components are not available only we can get evt.getNewValue for event produced component. Example there are 5 components in the page if the event got generated from the 3rd component so in that valuechange event method needs the first two components values also. In value binding I can't get those value but in the component binding every component's updated value I can get.That's why I mentioned AJAX enabling the view in the previous post.
    I can accept for 3rd party libraries if we use value binding it would be very easy to detach and use another one but for basic components I am not able to visualize the need to use the other >API, If my guess is right, for look and feel purpose means we can change the renderkit na.
    Please suggest me am I thinking in the right direction or notRichfaces, Tomahawk and many others have lots of components that solve common problems that you are going to meet when using plain JSF components.
    Yes people try to stick to standard JSF as much as possible but it is not always possible nor always beneficial.
    Like I said it's not hard and fast. As long as you understand the advantages and disadvantages of each technique so that you can chose the correct approach according to requirements.
    The memory differences are unlikely to impact in a major way.

  • Doubt about Component binding....

    I have a doubt about component binding because I am also using component binding in my application, in my application each page has more than 20 components and each page is session scope, at one point I am getting message like perm space(this is because of lack of memory, actually I have 4gb ram). So my is
    "does the jsf creates new object for every reload, because of that my jvm filling with all the objects?".
    Another question is "what is the difference between value binding and component bindings?, and drawbacks of each other" please tell me the differences between them up to the very low level(up to memory usage for each approach).
    Please clarify this doubt...........

    JNaveen wrote:
    I have a doubt about component binding because I am also using component binding in my application, in my application each page has more than 20 components and each page is session scope, at one point I am getting message like perm space(this is because of lack of memory, actually I have 4gb ram). So my is
    "does the jsf creates new object for every reload, because of that my jvm filling with all the objects?".This is regardless of the component binding. JSF creates a component tree and stores it in the session. With component binding you can link between the backing bean and the component without the need for UIViewRoot#findComponent().
    Think your problem lies somewhere else. Use a profiler.
    Another question is "what is the difference between value binding and component bindings?, and drawbacks of each other" please tell me the differences between them up to the very low level(up to memory usage for each approach).With the component binding you can get hold of the whole component from the tree in the backing bean. Useful if you want to do a bit more than only holding the component's value, with which you usually do with the value binding.

  • Component binding inside h:dataTable fails

    Hi,
    I'd like to create a component binding for each commandLink to a distinct child bean inside an h:dataTable like so:
    <h:dataTable value="#{parent.children}" var="child">
        <h:column>
            <h:commandLink binding="#{child.command1}" value="do it to it for #{child}" action="#{child.action}"/>
        </h:column>
    </h:dataTable>But whenever I try to render this page I get an exception stating that "child is null" and binding cannot be performed. If I remove 'binding="#{child.command1}"', however, everything works fine. I guess this is happening because 'var="child"' in h:dataTable gets evaluated after bindings are created. How can I get around that - I really need to be able to refer distinctly refer to UIComponents in each row.
    Confused...
    thanks
    -nikita

    I created a seperate class to handle the requests ActivationRequestBuilder and put the code in there .
    if you want to refer to each row in the backing bean .
    create a variable of type HtmlDataTable .
    private HtmlDataTable tenantDataTable;
    set up accessor and mutator methods for this variable.
    In your jsp in the DataTable
    <h:dataTable binding="#{activationRequestBuilder.tenantDataTable}"
    <h:commandLink title="Delete Tenant section"
    immediate="true" action="#{activationRequestBuilder.deleteTenantLocationSection}">
    public String deleteTenantLocationSection(){
    (TenantLocationRecordBean) this.getTenantDataTable().getRowData();
    This is just snippets of code but you should get the idea of what I have done here .I had multiple sections in a page so each row was a TenantLocationRecordBean .

  • h:dataTable with component binding not rendering

    Hello,
    I am developing an application with several ad-hoc queries that need to be displayed in data table elements. The number and label values of the columns are not known until runtime. I am attempting to use a component binding mechanism to intercept the UIData and add columns to it at runtime, depending on the data currently held in a backing bean instance (such as an ad-hoc query result).
    I'm not sure where I can actually intercept the table and add the columns. I've got the following code example to compile and run without error, but nothing gets rendered properly - I get an opening <table> tag in the HTML source and nothing else follows.
    I have compared the structure of the table created with the following binding method to a table created with simple <h:dataTable> tags, and I see only one difference. The datatable created with tags has a single attribute in its attribute map called "javax.faces.webapp.COMPONENT_IDS" that maps to an ArrayList of the component IDs of the h:column elements I specify on the JSF page. The datatable I attempt to create in the binding method does not have this attribute in its map, and I can't seem to manually add it in without creating further havoc. (the child count, types of children, etc all seem to be equivalent).
    From the JSF perspective this is how I've defined the h:dataTable tag instance...
    <h:dataTable id="categoryTable" rendered="true"
            binding="#{backingBeanInstance.table}"
                value="#{backingBeanInstance.rows}"
                    var="row"  border="2" />This is basically the code in the backingBeanInstance....
        private UIData table;
        public void setTable(UIData table){
            this.table = table;
           //initTable();   //tried this but seems not to work either?
        public UIData getTable(){
            if(table!=null){
                initTable(); //build the columns and add to the table
            return table
        private void initTable(int categoryIndex){
                //This block is just a way to calculate the number of columns
                int colCount = <depends on data held in bean>
                //Resolve the var string for the data table
                String item = table.getVar();
                System.out.println("item: " + item);  //this is always null the 1st time through?? why?
                UIColumn col;
                UIOutput out;
                FacesContext context = FacesContext.getCurrentInstance();
                Application app = context.getApplication();
                //For each column in the data, create a UIColumn as child of the
                //data table.  Create a UIOutput as child of the UIColumn and bind
                //the value of the UIOutput to the data with an EL expression
                for (int j = 0; j < colCount; j++) {
                    //create an instance of UIOutput to display the value for this cell
                    out = new UIOutput();
                    out.setRendererType("Text");
                    //create an instance of UIColumn
                    col = new UIColumn();
                    //construct the value binding string as an EL expression
                    String valueBindingString = "#{" + item + "[" + j + "]}";
                    //create the value binding
                    ValueBinding vb = app.createValueBinding(valueBindingString);
                    //set the value binding on the UIOutput object
                    out.setValueBinding("value", vb);
                    //add the UIOutput component to the UIColumn as a child
                    col.getChildren().add(out);
                    //add the UIColumn to the data table as a child
                    table.getChildren().add(col);
        }

    <bump>

  • COMPONENT binding

    Folks,
    does anybody know about detailed descriptions (with samples) of the Component binding feature in JSF? I would like to get my hands on a more detailed example than the one in the J2EE tutorial. The books I've seen so far put their focus on value and method binding but rarely anybody talks about component binding.
    Every (meaningful) response gets a DD!
    Thanks.

    http://jsftutorials.com/components/step5.html
    Probably, it is not very detailed, but with the example :-)
    You can assign the variable with the type of the component in the backing bean. This allows you to manipulate with all bunch on the component attributes.

  • Component binding setting

    Hi, I am trying to understand the setting of component binding during the JSF phases. From the specification, I understand the following (JSF 1.2, Section 2.2.1) Restore View -
    "For each component in the component tree, determine if a ValueExpression for “binding” is present. If so, call the setValue() method on this ValueExpression, passing the component instance on which it was found."
    So, from the above, it seems that after every Restore View phase for a ViewId, setXX() for the component binding should be called. However, at runtime, I dont see this. Is my understanding correct? Excatly, when will the setXX() for the component bindings be called?
    Thanks.

    Hi , thanks for your response. I had done some tests, before posting my original question. Here were my observations - I had created two views View 1 and View 2. From View 1, I can navigate to View 2 and vice versa. XXX is a component binding in View 1.
    Managed bean is on Pageflow Scope.
    1) When View 1 is launched the first time, I see that getXXX() is called, I return null here, so, setXXX() called initializing the component. This happens in the Restore View phase of View 1.
    2) Then, I navigate to View 2. Again, I see that setXXX() of View 1 is called and then View 2 is initialized. Again, this is in the Restore View phase, but that of View 2.
    3) I then navigate back to View 1. I dont see any setXXX() call at this time. Why is setXXX() not called in the Restore View phase?
    4) I then again navigate back to View 2. I see setXXX() again during Restore View phase of View 2.
    My understanding of this is that the UIViewRoot is initialized when the View is first shown. During its initialization (createView in ViewHandler), the components are initialized and component bindings on the managed beans are set. This is done in step 1. UIViewRoot may then be stored in the session (but I dont think this is mandated by spec and probably is implementation dependent). During a subsequent postback (as in step 3), UIViewRoot is retrieved by the ViewHandler (restoreView), and setXXX() should be called here again. After this it continues on with the remaining JSF phases. RestoreView itself may retrieve UIRootView from the session, or probably build it up using the State handling mechanism - StateHolder and its cronies.
    My confusion is - Why is setXXX() called during Restore View phase of View 2? At this time, it should not even bother about the UIViewRoot going out.
    Thanks again for your patience explaining the finer things of ADF/JSF.
    Kind regards.
    Edited by: user10624779 on Oct 11, 2010 8:37 PM

  • Simple component binding/JSF lifecycle question

    As a JSF newbie, I ran into an unexpected component binding state/JSF lifecycle issue. Given this JSP code:
    <h:inputText id="boundinput" binding="#{UserBean.boundInput}">and this Java setter code:
           private UIInput boundInput = new UIInput();
            public void setBoundInput(UIInput aBoundInput) {
                this.boundInput = aBoundInput;
                String value = aBoundInput.getValue();
            }the result of 'value' is the previous value of the input text field when the form is submitted. The component is bound, but why isn't the new value available?
    It seems to get the 'current' value of the bound component, a valueChangeListener has to be implemented? I may be missing something fundamental, so any help is appreciated.

    If you only want to get and set values, use valuebinding instead.
    If you're debugging the setBoundInput after form input, then yes, it is correct that the old value is still in there. This would be updated at a later JSF phase yet.
    Check http://balusc.xs4all.nl/srv/dev-jep-djl.html to get some insights in the JSF lifecycle.

  • Component binding and state saving

    Hello,
    I have a few questions in regards to component binding and state saving (specifically in regards to the reference implementation) when the saving method is client and backing-beans are in the request scope rather than in the session scope:
    1) if a component instance is bound to a backing-bean property then does the state of that component get saved when the view state is saved?
    2) for UIData component, if the component value is bound to a list, does the actual list (after being wrapped) serve as the local data for the component? If this is the case, when the state is saved and then subsequently restored, does the list get re-created with the original number of items?
    Regards,
    Len Takeuchi

    Thanks for the quick response.
    (2) The actual list is not saved; the list will be
    re-queried on subsequent requests.The list composition may have changed by the time the list is re-queried. If the table being displayed is updatable then transfer of information from request back to the list (during Apply Request Values) may not happen properly. So does that pretty much mean that the original list has to be kept around (in the session)? If the state saving method is server then does the saved state maintain a reference to the original list across requests?
    Len Takeuchi

  • PanelGrid with binding attribute not rendering when event on page fires

    I am having a similar issue with my components not being rendered from a dynamic binding attribute as described by this post:http://forum.java.sun.com/thread.jspa?threadID=671672 but for different reason. I have combed the forum and other sources for a week now, tried numerous variations of this based on suggestions I've read for rendering dynamic components and am unable to find the problem. I would appreciate guidance as I don't know what else to do and I imagine there is something basic about the JSF flow layout or component classes I am not doing correctly.
    From a high level, I have a page with two panel groups. The first contains a list of command links (like a menu) that have an actionlistener that populates a list of QueryVariable objects called filterCriteria in the backing bean based on the selection made and then calls a function to update components in the second panel. The second panelGroup contains a panelGrid with a binding attribute that constructs a dynamic set of input fields based on the content of the filterCriteria list. When I first naviagate to this page from another page, the fields are rendered properly. However, if I then select a commandLink from the menu, the panelGrid disappears and is not rendered.
    I've stepped through the code in a debugger and my actionlistener is called when I select a command link. However, the binding attribute method is not called at this time, so I added a direct call to it from the action listener. I know the actionlistener is working because I've verified it in the debugger and if I navigate away and come back to the page, then the binding method is called and the new selection is reflected in a rendered panelGrid. Why is it not rendering though when I first select the commandLink and the page is updated. Also, fyi, there is an action method for the commandlinks but it returns null;
    FWIW, I'm using MyFaces and Facelets in my application.
    Below is my code. This is inside a managed session bean:
    JSF Snippet:
    <h:panelGrid id="inputVarsTable" columns="3" binding="#{query.table}"/>
         public HtmlPanelGrid getTable() {
              if(table == null)
                   table = new HtmlPanelGrid();
              return constructSearchInputTable();               
         public void setTable(HtmlPanelGrid table) {
              this.table = table;
      // Updates table component to reflect filterCriteria
         public HtmlPanelGrid constructSearchInputTable()
              HtmlOutputLabel outLabel;
              HtmlOutputText outText;
              HtmlInputText  inText;
              HtmlMessage message;
              List<UIComponent> children;
              ValueBinding vb;
              FacesContext facesContext = FacesContext.getCurrentInstance();
              UIViewRoot uIViewRoot = facesContext.getViewRoot();
            Application application = facesContext.getApplication();
              children = table.getChildren();
        children.clear();
              try {
                   for (int i = 0; i < getFilterCriteria().size(); i++) {
                        QueryVariable var = getFilterCriteria().get(i);
                        String id = "var" + i;
                        //<h:outputLabel for="#{var.name}" styleClass="label">
                        outLabel = new HtmlOutputLabel();               
                        outLabel.setFor(id);
                        outLabel.setStyleClass("label");
                        //  <h:outputText value="#{var.name}" />
                        outText = new HtmlOutputText();
                        outText.setValue(var.getName());
                        outText.setParent(outLabel);
                        outLabel.getChildren().add(outText);
                        outLabel.setParent(table);
                        children.add(outLabel);
                        //<h:inputText id="#{var.name}" value="#{var.value}" required="true" />
                        inText = new HtmlInputText();
                        inText.setId(id);
                        String bind = "#{query.filterValues['" + var.getName() + "']}";
                        inText.setValueBinding("value", application.createValueBinding(bind));
                        if(var.getDefaultValue() == null)
                             inText.setRequired(true);
                        inText.setParent(table);
                        children.add(inText);
                        //<h:message for="#{var.name}" styleClass="errorText"/>
                        message = new HtmlMessage();
                        message.setFor(id);
                        message.setStyleClass("errorText");
                        message.setParent(table);
                        children.add(message);     
              } catch (Exception e) {
                   log.error(e);
              return table;
      // Command Link Menu ActionListener
         public void structuredQuerySelection(ActionEvent e) {
              queryType = QueryType.StructuredQuery;
              UICommand cmd = (UICommand) e.getSource();
              filterSelection = (String) cmd.getValue();
              Map<String, SearchRequestCtx> queries = pdp.getGenericMetadata().savedQueries;
              SearchRequestCtx ctx = queries.get(filterSelection);
              filterCriteria = new ArrayList<QueryVariable>();
              filterCriteria.addAll(ctx.getVariables());
              constructSearchInputTable();
         // Command Link Menu Action
         public String selectStructuredQuery()
              return null;
         }BTW, this is my first post and I don't really know how that Duke Dollar thing works but I'm happy to offer some to anyone that can solve this issue for me.
    Thanks,
    Ken

    Glad to hear I am not the only one struggling with this type of issue.
    I tried your suggestion but it caused a NoSuchElementException when the page tried to render. Stepping through the code, the init function is always called after my panelGrid is constructed. I even commented out the logic to clear the children and confirmed that in the constructed page, the outputText component that binds to init is the first element on the page - right after the opening body tag. Maybe, JSF doesn't necessarily construct the page in top to bottom order? Also, the exception makes me think that this gets called too late in the lifecycle to work. Were you able to get this to work?
    java.util.NoSuchElementException
         at java.util.AbstractList$Itr.next(AbstractList.java:427)
         at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:515)
         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:445)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)Ken

Maybe you are looking for

  • ORA-00439 error when deploying a simple dimension

    Hello, I am using Oracle Warehouse Builder 11g SE to try to implement a simple data warehouse. I have created the dimensions and cube using ROLAP, defined simple mappings and added process flow and was now trying to deploy the objects. When i try to

  • Final Cut Pro X Export Help...

    I have Final Cut Pro X 10.0.5 installed and I'm editing a video I made a while back; the RAW version I made was 700MB+ and the edited/exported version came out to 136MB (That I'm working on now) wants to be exorted as 441.4MB. I want to know how to g

  • DMS BP giving 'requested resource is not available' error

    Hello, smart KM people  I'm having a problem with our DMS business package in our EP6 SP16 portal.  I configured the DMS repository manager successfully.. and the Document Explorer workset is functional and I'm able to navigate through the folder str

  • Facebook Video with Mac Pro

    Hi all, Can anyone tell me if they're having problems with Facebook Video Calling with Mac? Everytime I use it, I get the following pop up. I click allow, and the call connects. My own image just freezes onto the window and I can hear the other perso

  • Buying a new macbook pro, i5 vs i7?

    I am about to buy a new macbook pro and was wondering which processor would be better. I am planning on working with Final Cut Studio often and want something that operates quickly. Anything else I should look for, I am planning on picking one up off