primefaces-extensions: CombinedResourceHandler: MyFaces ParseError in Dev Mode
Describe the bug @tandraschko I have attached this reproducer: pfe-combinedresourcehandler.zip
To get the issue run the reproducer mvn clean jetty:run -Pmyfaces23
with JSF mode Development and press the “Update” button twice. On the second press you will see this in the console for the AJAX response.
Now run the reproducer again in JSF mode Production mvn clean jetty:run -Pmyfaces23
and there is no errors or problems. I think it stems from MyFaces having an issue with duplicate ID’s for this piece of code in our handler:
https://github.com/primefaces-extensions/primefaces-extensions/blob/fd939e77a2e26c765bd06efa5692fde8e3fba4b2/core/src/main/java/org/primefaces/extensions/application/PrimeFacesScriptProcessor.java#L169-L175
I used to have ID’s on there but had to be removed because of this ticket: https://github.com/primefaces-extensions/primefaces-extensions/issues/486
Any thoughts you have on this would be appreciated. It works fine in Mojarra in Development mode but I am wondering which library is doing the right thing?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 29 (19 by maintainers)
Commits related to this issue
- Fix #517: PrimeFacesScriptProcessor prevent duplicate id error in MyFaces dev mode — committed to blutorange/core by melloware 3 years ago
- Fix #517: DO not add scripts in restore view phase in MyFaces — committed to jepsar/primefaces-extensions by melloware 9 months ago
- Fix #517: PrimeFacesScriptProcessor prevent duplicate id error in MyFaces dev mode — committed to Rapster/core by melloware 3 years ago
Oh sorry @volosied I think @mkomko is on JSF 4.0+
@mkomko What JSF version do you need the fix in?
@mkomko yep they have a MyFaces fix going in for your issue.
I can take another look at this. I think my fix to assign ids to child elements is reasonable to address the duplicate id exception, and I don’t see why the community would reject it.
I also removed the
PostAddToViewEvent
publish event in the restore view phase to avoid the duplicate scripts. However, I see duplicate scripts (css) added when i click update in the test app:see here:
OK @tandraschko here is what I have discovered in my research and settled on because I don’t know exactly what is wrong in MyFaces or MAY NOT BE WRONG it could be wrong in Mojarra who knows. But…
UIViewRoot.addComponentResource
as reported in this ticket: https://github.com/primefaces-extensions/primefaces-extensions/issues/486The solution I settled on was to set an ID for MyFaces and leave it blank for Mojarra. I have tested and this now works for all 4 use cases MyFaces and Mojarra and Development mode and Production Mode.
cc @Phipsee since you reported the issues with Mojarra I wanted you to see this ticket.