[richfaces-issues] [JBoss JIRA] (RF-12945) Dynamic tab panels don't work in ajax mode

Brian Leathem (JIRA) jira-events at lists.jboss.org
Sat Apr 27 00:52:54 EDT 2013


    [ https://issues.jboss.org/browse/RF-12945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770513#comment-12770513 ] 

Brian Leathem commented on RF-12945:
------------------------------------

The key here is the binding of the _value_ attribute of the _c:foreach_ tag handler to a @ViewScoped bean.  This was explained exteremely clearly by [~bauke] in a blog post http://balusc.blogspot.ca/2011/09/communication-in-jsf-20.html#ViewScopedFailsInTagHandlers:

{quote:}
When you bind an attribute of a tag handler by an EL value expression to a view scoped bean, then it will create a brand new view scoped instance upon every request, even though it's a postback to the same view. This is a chicken-egg issue as stated in [JSF issue 1492|https://java.net/jira/browse/JAVASERVERFACES-1492] which is fixed in JSF 2.2 and for Mojarra 2.1 backported in version 2.1.18. Simply put, JSF needs to restore the partial view in order to get the view state (and all view scoped beans) back. However, tag handlers runs during view build/restore time when JSF is about to construct the component tree. So they will run first and not be aware about any beans available in the view scope. When restoring the view is finished, the original view scoped beans are found and will be put back in the view scope. However, all EL value expressions of the tag handlers have already obtained the evaluated value of a completely different view scoped bean instance beforehand!
{quote}

This explains whey the problem is only onbserve in JBoss AS 7.1 (Mojarra 2.0.7) and not in JBoss EAP 6.1 Beta (Mojarra 2.1.19), and only when the backing bean is @ViewScoped, and not @SessionScoped.

This was not observed in RichFaces 4.3.0/4.3.1 as the tab was the source of the ajax call, where as in 4.3.2 we've reverted to using the tabPanel as the source of the ajax call (to preserve the backwards compatibility of ajax attributes on the tab component - see RF-12839).

Also note, this works fine in 4.3.2 when you use an _a4j:repeat_ tag instead of _c:foreach_.
                
> Dynamic tab panels don't work in ajax mode
> ------------------------------------------
>
>                 Key: RF-12945
>                 URL: https://issues.jboss.org/browse/RF-12945
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-panels-layout-themes, regression
>    Affects Versions: 4.3.2
>         Environment: RichFaces 4.3.2.CR1
> Metamer 4.3.2-SNAPSHOT
> JBoss AS 7.1.3.Final-redhat-4
> Java(TM) SE Runtime Environment 1.7.0_04-b20 @ Linux
> Chrome 26.0.1410.63 @ Linux x86_64, Firefox 20
>            Reporter: Pavol Pitonak
>            Priority: Critical
>
> # deploy Metamer and open http://localhost:8080/metamer/faces/components/richTabPanel/addTab2.xhtml
> # click the button with label "[h] Create tab"
> # switch to second tab (content of tab will change)
> # switch to tab 6
> result:
> * ajax request is performed but tab panel's content doesn't change (it's still tab2)
> * worked fine in RichFaces 4.3.1.Final
> * dynamic panel can't be removed, there is an error message in browser console:
> {quote}
> Uncaught TypeError: Cannot call method 'onCompleteHandler' of undefined
> {quote}
> This issue might be related to RF-11081 or RF-12513.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list