0

Currently I have a problem similar to jsf listener not called inside nested ui:repeat
After I got the solution of this problem I upgraded Mojarra to Version 2.1.16.
Everthing works fine, up to the moment I was implementing the below-mentioned view.
The Code is simplified to the basics.


xhtml:

<form>
  <div>
    // listener is called
    <h:commandLink value="test1">
      <f:ajax event="click" listener="#{testBean.testListener}" />
    </h:commandLink>
    <ui:repeat var="testList" value="#{testBean.testList}">
      // listener is not called !
      <h:commandLink value="test2">
        <f:ajax event="click" listener="#{testBean.testListener}" />
      </h:commandLink>          
    </ui:repeat>
  </div>
</form>


bean:

@ManagedBean(name="testBean")
@ViewScoped
public class TestBean {
  private Collection<TestObj> testList;
  public Collection<TestObj> getTestList() {
    return this.testList;
  }

  // the listener
  public void testListener() {
    ...
  }
}


Even if I change ui:repeat to c:forEach, the problem is the same!
Just if I use @SessionScope instead of @ViewScope the 2nd commandLink (inside the iteration) calls the listener. But I'd like to avoid @SessionScope at this bean.

Do you have any hints for me about the reason of this problem and how to handle it?

Community
  • 1
  • 1
user2090297
  • 23
  • 1
  • 3
  • Can you put breakpoint on `@PostConstruct` method and see if it is called after click on link inside `ui:repeat`? Just to check if bean is recreated on AJAX request. – partlov Mar 14 '13 at 10:41
  • Yes, the bean is recreated on both ajax requests. So the reinitialized collection contains other objects than listed with `ui:repeat`. This means jsf is not able to find the objects of the collection in the dom-tree, so the nested the listener is not called!? But shouldn't `c:forEach` avoid this problem? – user2090297 Mar 14 '13 at 11:04
  • Can you post code for whole page? – partlov Mar 14 '13 at 11:06

0 Answers0