-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component wrapping does not work properly in 2.3.17 #5065
Comments
Please remove PrimeFaces from the mix altogether to see if it is Mojarra causing the issue. |
I did some debugging add it seems as this different behavior is because of the new introduced "DescendantMarkIdCache". Behavior with Mojarra 2.3.16: During RENDER_RESPONSE: primefaces FilterFeature#filter does take the filter value from the datatable object which is the same as in RESTORE_VIEW. Behavior with Mojarra 2.3.17: The datatable object was added to the Cache as child oft he composite component but was also removed afterwards. If the datatable inside the composite component is inside another faces component, the datatable component is found by ComponentTagHandlerDelegateImpl#findReparentedComponent method. Maybe @BalusC could have a short lock, if the cache is working properly? |
I created a reproducer without primefaces, so it is still the testcase provided from primefaces but I removed all decencies to primefaces. This reproducer uses just a <h:selectOneListbox>, but it could be any component. My example contains 2 views.
In the logging of both you will see, that for the component which is wrapped in the 'htmlWrapper' during RENDER_RESPONSE a new object instance is created. This does not happen, if no composite component is used or there is a other component in the composite component. This only happens with Mojarra 2.3.17, it does not happen with Mojarra 2.3.16. There the object instance stays the same during the request. Logging with Mojarra 2.3.16:
Logging with Mojarra 2.3.17:
So with Mojarra 2.3.17 a new component instance was create during RENDER_RESPONSE if the component is inside the htmlWrapper composite component. This does not happen with Mojarra 2.3.16. |
Probably a regression because of #4934 |
Excellent analysis/reproducer, very helpful. And yes Manfred this indeed looks like to be a regression of this original work: #4808 |
composite panel returning null on getId()
Okay, nailed down. This does at first glance not seem to be a regression but just an existing bug being uncovered which was previously seemingly worked around with the original inefficient implementation of
// grab our component
UIComponent c = findChild(ctx, parent, id);
if (null == c &&
context.isPostback() &&
UIComponent.isCompositeComponent(parent) &&
parent.getAttributes().get(id) != null) {
c = findReparentedComponent(ctx, parent, id);
} Technically speaking, the Since the performance optimizations of As to reparenting, during view build time of postback, the composite component basically creates during if (ComponentHandler.isNew(c)) {
facetComponent = (UIPanel)
facesContext.getApplication().createComponent("javax.faces.Panel");
facetComponent.setRendererType("javax.faces.Group");
c.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, facetComponent);
} If its direct child is a //store the new parent's info per child in the old parent's attr map
//<child id, new parent>
for (UIComponent c : compositeChildren) {
String key = (String)c.getAttributes().get(ComponentSupport.MARK_CREATED);
String value = component.getId(); // <-- this unexpectedly returned null
if (key != null && value != null) {
compositeParent.getAttributes().put(key, value);
}
} In case of the // grab our component
UIComponent c = findChild(ctx, parent, id);
if (null == c &&
context.isPostback() &&
UIComponent.isCompositeComponent(parent) &&
parent.getAttributes().get(id) != null) { // <-- condition not satisfied here
c = findReparentedComponent(ctx, parent, id);
} The fix was explicitly set ID of Will add IT later after I've verified that all existing 2.3 tests pass. |
composite panel returning null on getId()
@BalusC, thank you for the fixing this so fast. |
Conflicts: impl/src/main/java/com/sun/faces/application/resource/ResourceCache.java impl/src/main/java/com/sun/faces/config/ConfigureListener.java impl/src/main/java/com/sun/faces/config/WebConfiguration.java impl/src/main/java/com/sun/faces/facelets/tag/jsf/CompositeComponentTagHandler.java
Describe the bug
We recently upgraded our Wildfly to version 26.0.1 which now provides JSF version 2.3.17. We have a case in which we use simple composite components which can wrap more complex components (more specificly the PrimeFaces DataTable). If the wrapping component only consists of simple html-Elements, the wrapped component will not work properly. First I thought this might be a problem with PrimeFaces, so I created a primefaces-test project reproducing the issue (see below). But when starting the project with Mojarra 2.3.17 the problem is reproducable, while with mojarra 2.3.16 it is not. This was causing me to believe that there might be a problem with the current Mojarra 2.3.17 release.
To Reproduce
reproducer.zip
Steps to reproduce the behavior:
I have also added a profile -Pmojarra2316 which you can use to counter-check that it actually did work with Mojarra 2.3.16.
Expected behavior
Same behaviour as Mojarra 2.3.16 (working)
Desktop (please complete the following information):
Additional context
We found a workaround for now which consists of using facelet-tags instead of composite components in this scenario. When doing that, the clientId gets shortened, since the wrapping components Id does no longer show up in it. So I suspect the issue might lie in the detection of components on server-side. Unfortunately though I was not able to find any evidence for this. It would be great if someone with more insight could take a look at it.
The text was updated successfully, but these errors were encountered: