h:commandLink inside richfaces dataTable not working properly after pressing browser back button

180 views Asked by At

After I've done some investigation on such issue online, I am still not able to find a proper solution. The tech stack I have to use here is JSF 1.x, JBoss Seam 2.2.x and richfaces 3.3.x. So the scenario is:

  1. UI

The page contains two main parts, the upper one is providing some criteria for users to search results, and the lower one is to display the results. Here I am using richfaces.dataTable to populate the results. We also provide the link to load the details of a result item (h:commandLink). The dataTable of course is initially not shown up using rendered attribute of h:panelGroup. It looks like:

<h:panelGroup rendered="#{results.size gt 0 and not showDetail}"> 
    <rich:dataTable
                    id="results-table"
                    value="#{results}"
                    var="row"
                    rows="#{rowPerPage}"
                    styleClass="table"
                    rendered="#{not empty requests}">  
    ......     
      <rich:column>
        <f:facet name="header">
            Action
        </f:facet>
        <h:commandLink value="DETAILS"
                       action="#{viewBean.showDetailContext(row)}"
                       styleClass="link">
        </h:commandLink>
      </rich:column>
      ......
    </rich:dataTable>
</h:panelGroup>
  1. ViewBean

Code:

@Scope(ScopeType.CONVERSATION)
@Name("result.view")
public class ResultView {
public void showDetailContext(T detailContext) throws Exception {
    _detailContext = detailContext;
    initListDetails();
    setShowDetail(true);
}
protected void initListDetails() throws Exception { 
   //...... 
}
}

After doing some search, the UI will be like: View with Results

So at this moment, users can click the "Details" link and navigate to the detail view like: Details View

The problem now is when we click the browser back button, we go back to the previous "View with Results" and if users click the Details link of a different item, the Details View will still display the previous detail information as highlighted in the screenshot.

Any advice is highly appreciated.

0

There are 0 answers