ICEfaces
  1. ICEfaces
  2. ICE-5226

component binding does not work in View scope and partial submit with compat

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      jsf2.0, icefaces 2.0, compat
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial, Compatibility/Configuration

      Description

      Using View Scope and component binding, and example of HtmlInputText with session scope for both jsf2.0 and ICEfaces 2.0 bind the value of the component to the component directly bound in the backing bean. Using partial submit, the correct value is not always displayed. However, with View scope, (for example using TextEntry in compat showcase and add a component binding to the backing bean), the bean is not the same instance for each partial submit and the component bound directly to backing bean is null.

        Issue Links

          Activity

          Judy Guglielmin created issue -
          Hide
          Judy Guglielmin added a comment -

          Also, ICE-5219 depends on this

          Show
          Judy Guglielmin added a comment - Also, ICE-5219 depends on this
          Judy Guglielmin made changes -
          Field Original Value New Value
          Link This issue blocks ICE-4458 [ ICE-4458 ]
          Judy Guglielmin made changes -
          Link This issue blocks ICE-5219 [ ICE-5219 ]
          Ken Fyten made changes -
          Salesforce Case []
          Affects Version/s 2.0-Alpha2 [ 10214 ]
          Affects Version/s 2.0-Alpha1 [ 10213 ]
          Ken Fyten made changes -
          Salesforce Case []
          Fix Version/s 2.0-Alpha2 [ 10214 ]
          Assignee Priority P2
          Assignee Judy Guglielmin [ judy.guglielmin ]
          Hide
          Ken Fyten added a comment -

          Need to ascertain if View scope should be supporting comp. binding or not in JSF2.

          Show
          Ken Fyten added a comment - Need to ascertain if View scope should be supporting comp. binding or not in JSF2.
          Ken Fyten made changes -
          Assignee Judy Guglielmin [ judy.guglielmin ] Ted Goddard [ ted.goddard ]
          Hide
          Judy Guglielmin added a comment -

          Using basic-ajax2 example of jsf2.0 distribution (binary dist has several examples), I added component binding to class Echo for an HtmlInputText standard jsf component.
          @ManagedBean(name = "echo")
          @SessionScoped
          public class Echo implements Serializable {

          HtmlInputText inputTextBinding;
          public HtmlInputText getInputTextBinding()

          { if (inputTextBinding!=null) System.out.println(" bean="+this+" get inputTextBinding="+this.inputTextBinding+" id="+this.inputTextBinding.getValue()); else System.out.println("getter is null"); return inputTextBinding; }

          public void setInputTextBinding(HtmlInputText inputTextBinding)

          { this.inputTextBinding = inputTextBinding; if (inputTextBinding !=null) System.out.println(" bean="+this+" SET inputTextBinding="+this.inputTextBinding+" id="+this.inputTextBinding.getValue()); else System.out.println("it's null"); }

          ....

          and modify the following in echo1.xhtml:-
          Output: <h:outputText id="out1" value="#

          {echo.str}"/>
          <br/>
          Input: <h:inputText id="in1" value="#{echo.str}

          " binding="#

          {echo.inputTextBinding}

          "/>

          You can then see that jsf2.0 in Session scope allows component binding when a full form submit is done. If using <f:ajax> tag, I wasn't able to get the component binding to return the correct value. If using View scope, a different instance of the bean is used each time so no component binding is returned to the backing bean. (just keep getting a new one).

          Similar results when modifying the input Text example of component-showcase.

          Show
          Judy Guglielmin added a comment - Using basic-ajax2 example of jsf2.0 distribution (binary dist has several examples), I added component binding to class Echo for an HtmlInputText standard jsf component. @ManagedBean(name = "echo") @SessionScoped public class Echo implements Serializable { HtmlInputText inputTextBinding; public HtmlInputText getInputTextBinding() { if (inputTextBinding!=null) System.out.println(" bean="+this+" get inputTextBinding="+this.inputTextBinding+" id="+this.inputTextBinding.getValue()); else System.out.println("getter is null"); return inputTextBinding; } public void setInputTextBinding(HtmlInputText inputTextBinding) { this.inputTextBinding = inputTextBinding; if (inputTextBinding !=null) System.out.println(" bean="+this+" SET inputTextBinding="+this.inputTextBinding+" id="+this.inputTextBinding.getValue()); else System.out.println("it's null"); } .... and modify the following in echo1.xhtml:- Output: <h:outputText id="out1" value="# {echo.str}"/> <br/> Input: <h:inputText id="in1" value="#{echo.str} " binding="# {echo.inputTextBinding} "/> You can then see that jsf2.0 in Session scope allows component binding when a full form submit is done. If using <f:ajax> tag, I wasn't able to get the component binding to return the correct value. If using View scope, a different instance of the bean is used each time so no component binding is returned to the backing bean. (just keep getting a new one). Similar results when modifying the input Text example of component-showcase.
          Hide
          Judy Guglielmin added a comment -

          Have to determine if
          1) there is a bug in jsf2.0
          2) should component-binding work in View Scope? or do we have to use Session scope for it?

          Can always look up the component in the tree (using find method of the CoreComponentsUtil class)

          Show
          Judy Guglielmin added a comment - Have to determine if 1) there is a bug in jsf2.0 2) should component-binding work in View Scope? or do we have to use Session scope for it? Can always look up the component in the tree (using find method of the CoreComponentsUtil class)
          Hide
          Ted Goddard added a comment -

          I believe this is a bug in JSF 2.0.2. A bug has bee filed:

          https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1492

          In the meantime we should use findComponent()

          Do we have a component JIRA for implementing this pagination behavior without a component binding or findComponent()?

          Show
          Ted Goddard added a comment - I believe this is a bug in JSF 2.0.2. A bug has bee filed: https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1492 In the meantime we should use findComponent() Do we have a component JIRA for implementing this pagination behavior without a component binding or findComponent()?
          Hide
          Ted Goddard added a comment -

          Judy, please add a reference the new paginator JIRA.

          Show
          Ted Goddard added a comment - Judy, please add a reference the new paginator JIRA.
          Ted Goddard made changes -
          Assignee Ted Goddard [ ted.goddard ] Judy Guglielmin [ judy.guglielmin ]
          Hide
          Judy Guglielmin added a comment -

          For workaround, the datapaginator of the component-showcase example uses the CoreComponentsUtil method of find too look up the component in the tree to set it in the backing bean

          Show
          Judy Guglielmin added a comment - For workaround, the datapaginator of the component-showcase example uses the CoreComponentsUtil method of find too look up the component in the tree to set it in the backing bean
          Ken Fyten made changes -
          Salesforce Case []
          Fix Version/s 2.0-Beta [ 10032 ]
          Fix Version/s 2.0-Alpha2 [ 10214 ]
          Ken Fyten made changes -
          Salesforce Case []
          Fix Version/s 2.0-Beta [ 10231 ]
          Fix Version/s 2.0-Alpha3 [ 10032 ]
          Assignee Priority P2
          Assignee Judy Guglielmin [ judy.guglielmin ]
          Ken Fyten made changes -
          Assignee Mark Collette [ mark.collette ]
          Ken Fyten made changes -
          Salesforce Case []
          Affects [Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial, Compatibility/Configuration]
          Ken Fyten made changes -
          Salesforce Case []
          Fix Version/s 2.0-Alpha3 [ 10032 ]
          Fix Version/s 2.0-Beta [ 10231 ]
          Hide
          Ken Fyten added a comment -

          DataPaginator demo in compat showcase needs to be updated to reflect "best practice" with respect to avoiding component binding.

          Show
          Ken Fyten added a comment - DataPaginator demo in compat showcase needs to be updated to reflect "best practice" with respect to avoiding component binding.
          Hide
          Mark Collette added a comment -

          Let's assume we have a state holder bean, in session or view scope. Now let's add a standard request scope bean, to hold our component binding, and act as a a controller. In the faces-config.xml, add the following:

          <managed-bean>
          <managed-bean-name>stateHolder</managed-bean-name>
          <managed-bean-class>org.icefaces.StateHolder</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
          </managed-bean>

          <managed-bean>
          <managed-bean-name>controller</managed-bean-name>
          <managed-bean-class>org.icefaces.Controller</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
          <managed-property>
          <property-name>stateHolder</property-name>
          <value>#

          {stateHolder}

          </value>
          </managed-property>
          </managed-bean>

          Now, the controller can use component bindings as well as regular ValueBindings to the display, and receive events. It doesn't matter that it can't hold state, since it has a reference to the session scoped bean, which simply holds long-term state.

          Show
          Mark Collette added a comment - Let's assume we have a state holder bean, in session or view scope. Now let's add a standard request scope bean, to hold our component binding, and act as a a controller. In the faces-config.xml, add the following: <managed-bean> <managed-bean-name>stateHolder</managed-bean-name> <managed-bean-class>org.icefaces.StateHolder</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>controller</managed-bean-name> <managed-bean-class>org.icefaces.Controller</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>stateHolder</property-name> <value># {stateHolder} </value> </managed-property> </managed-bean> Now, the controller can use component bindings as well as regular ValueBindings to the display, and receive events. It doesn't matter that it can't hold state, since it has a reference to the session scoped bean, which simply holds long-term state.
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21550 Fri May 28 15:04:24 MDT 2010 mark.collette ICE-5226 : component binding does not work in View scope and partial submit with compat
          Files Changed
          Commit graph ADD /icefaces/scratchpads/glimmer/compat/samples/component-showcase/src/org/icefaces/application/showcase/view/bean/examples/component/dataPaginator/DataScrollingController.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/samples/component-showcase/src/org/icefaces/application/showcase/view/bean/examples/component/dataPaginator/DataScrollingModel.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/samples/component-showcase/web/WEB-INF/includes/examples/custom/dataTable-dataScrolling.xhtml
          Hide
          Mark Collette added a comment -

          Added a request scoped bean to hold the component binding, and to receive the ValueChangeEvent which made use of the component binding. Didn't need to tie the two beans together, since the new controller only needed static state from the model.

          Subversion 21550
          glimmer\compat\samples\component-showcase\src\org\icefaces\application\showcase\view\bean\examples\component\dataPaginator\DataScrollingController.java
          glimmer\compat\samples\component-showcase\src\org\icefaces\application\showcase\view\bean\examples\component\dataPaginator\DataScrollingModel.java
          glimmer\compat\samples\component-showcase\web\WEB-INF\includes\examples\custom\dataTable-dataScrolling.xhtml

          Show
          Mark Collette added a comment - Added a request scoped bean to hold the component binding, and to receive the ValueChangeEvent which made use of the component binding. Didn't need to tie the two beans together, since the new controller only needed static state from the model. Subversion 21550 glimmer\compat\samples\component-showcase\src\org\icefaces\application\showcase\view\bean\examples\component\dataPaginator\DataScrollingController.java glimmer\compat\samples\component-showcase\src\org\icefaces\application\showcase\view\bean\examples\component\dataPaginator\DataScrollingModel.java glimmer\compat\samples\component-showcase\web\WEB-INF\includes\examples\custom\dataTable-dataScrolling.xhtml
          Hide
          Mark Collette added a comment -

          This was the only component binding in compat component-showcase.

          Show
          Mark Collette added a comment - This was the only component binding in compat component-showcase.
          Mark Collette made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 2.0.0 [ 10230 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Alejandro Cuervo added a comment -

          it doesn't work, the state holder bean is also reload when dataPaginator or another component with partiall submit is clicked

          Show
          Alejandro Cuervo added a comment - it doesn't work, the state holder bean is also reload when dataPaginator or another component with partiall submit is clicked
          Hide
          Alejandro Cuervo added a comment -

          the state holder bean has view scope

          Show
          Alejandro Cuervo added a comment - the state holder bean has view scope

            People

            • Assignee:
              Mark Collette
              Reporter:
              Judy Guglielmin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: