• Post Reply Bookmark Topic Watch Topic
  • New Topic

h:dataTable with multiple Windows in the same session  RSS feed

Laurent Salse
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to display a collection of objects I use a standard JSF dataTable like this :

<hataTable value="#{visit.objectList}" var="rowObject" binding="#{actionBean.objectTable}" id="myTable" >
  • ' visit ' is a SessionScope ManagedBean
  • ' actionBean ' is a RequetScope BackingBean
  • ' objectTable ' is a UIData property of actionBean.

  • The list is displayed page by page with a poolLenght of 10 entries ;

    I use a commandLink on one column in order to select one Object and to display its properties in the next view :

    <h:commandLink id="selectObj" action="#{actionBean.selectObject}">
    <h utputText value="#{rowObject.apps}" id="rowApp" />

    Here is my Java method ' actionBean.selectObject() ' to instantiate the selected object :
    MyObject obj= (MyObject ) this.getObjectTable().getRowData();

    Everything works fine untill I decide to display twice the same list in 2 different windows (within the same session : right click -> New -> Window) :
  • I FIRST list the first 10 entries of the dataBase in one window.
  • THEN, I list the next 10 entries of the dataBase in a 2nd window.

  • In order to be able to select one rowData, I put the list as a property of a SessionScope object ' visit ' ;

    Then, when selecting the 1st row of the FIRST Window, JSF selects the 1st row of the SECOND Window, since this one is the result of the last request.

    Even if the 1st objectList in SessionScope 'visit' has been overloaded by the 2nd request, JSF is still able to detect the rowIndex I am selecting in the DataTable of the 1st window, but it seems that JSF has switched the link to the UIData property 'objectTable' to the one of the second instance of RequestScope 'actionBean' ; JSF WOULD NOT PERSIST a different RequestScope 'BackingBean'for each request executed into a different Window.

    Is JSF capable to instantiate (w. a distincitve ID) only one RequestScope 'ManagedBean' in the FacesContex ?
    [ May 23, 2006: Message edited by: Laurent Salse ]
    Miro Ricco
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi, I've solved it.

    I have a bean which manages a dynamic list of "data models".
    When the bean is requested to return the data for a table, it looks via FacesContext for the ID and by that ID it uses the particular data.

    Try to understand my TableIdHolder in this thread:

    Hope this helps.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!