1
votes

When using h:commandlink(or commandbutton) inside a rich:dataTable, the action specified is never invoked, neither is the corresponding managed bean instantiated(whether it is at request or session scope)... instead, the same request is performed.. (page reloads).. have seen what appeared to be similar issue on forums, but is not actually the problem i am having.. the h:commandlink /button work ok outside of the rich:datatable..

Does anyone have any advice?

here is a code snippet:

    <h:commandLink id="commLink" actionListener="#{hBean.test}" action="#{hBean.viewTranslation}">
        <h:outputText value="#{trans.translationName}"/>   
    </h:commandLink>
</rich:column>
2

2 Answers

2
votes

The bean is apparently request scoped and the datamodel is not been loaded during bean's construction (at least, during apply request values phase of the subsequent request). You need to preserve the same datamodel for the subsequent request, else JSF cannot locate the row item associated with the clicked link. The most straightforward way is to load the datamodel in the bean's constructor or @PostConstruct method.

A quick fix/test is to put bean in session scope. The datamodel will then be saved in the session scope and be available in the subsequent request. But this has more impact on user experience (e.g. unexpected results when having the same page opened in different browser windows/tabs in the same session). If you're already on JSF 2.0 (which is likely not the case since you're using RichFaces), then the new view scope would have been the solution.

Related questions:

0
votes

If you are using RichFaces 3.0.0 through 3.3.3, use the tag a4j:keepAlive. It will works even with request scope.