0 Replies Latest reply on Feb 20, 2014 11:04 AM by kwutzke

    JSTL c:forEach causes CDI (Seam 3) @ViewScoped bean to invoke @PostConstruct on every AJAX request using Mojarra 2.1.18+

    kwutzke

      This is a followup question to some questions on stackoverflow.com:

       

      http://stackoverflow.com/q/2842401/396732

      http://stackoverflow.com/q/2797231/396732

       

      However, we're using Mojarra 2.1.22 but our Seam 3 CDI @ViewScoped annotated beans always become reconstructed, that is the method annotated with @PostConstruct is executed and we get an new bean on every AJAX request.

       

      All I keep hearing for a few months (it's February 2014 now) is that Mojarra 2.1.18+ has many of these bugs fixed and that the view-scoped bean should survive AJAX requests when the view is using this bean from a <c:forEach>.

       

      Here are a few bugs:

       

      https://java.net/jira/browse/JAVASERVERFACES-1665

      https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-928 (see last comment by dwightd)

      https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-787

      https://java.net/jira/browse/JAVASERVERFACES-2688

       

      The only difference to the examples on SO etc. is that we're using Seam 3 CDI @ViewScoped (+ @Named) and not "native" JSF @ViewScoped (+ @ManagedBean).

       

      Is Seam 3 Faces (3.1 Final) the reason why it isn't working? Is this a Seam 3 issue at all? How can we find out? It's not easy to port the current functionality to a test case...

       

      Thanks

      Karsten