commandButton with onclick() and onsucces() gives error "javax.faces.FacesException: Missing CSP nonce"

UI Components for JSF
Post Reply
s_kenkre
Posts: 28
Joined: 01 Apr 2020, 16:08

09 Jul 2020, 09:23

Hello,
I came across this issue when I was working on primefaces migration from 3.4.2 to 8.0 community edition.

I have the below commandButton named "Order Now" in customerOrderHome.xhtml file.

Code: Select all

<p:panelGrid id="extCustBtn" columns="1" style="text-align: center !important; width: 100% !important;" rendered="#{customerSelection.selectedCustOptn eq 'existing'}" >
<p:commandButton id="ordrButton" onclick="PF('statusDialog').show();" onsuccess="PF('statusDialog').hide();" rendered="#{customerSelection.allCustomers != null and fn:length(customerSelection.allCustomers) > 0 and customerSelection.selectedCustomer != null}" action="#{customerSelection.customerListenerOrderNow}" 
							 value="Order Now">							    
	<f:setPropertyActionListener target="#{customerMgmnt.includeURL}" value="/CustomerManagement/newOrder.xhtml"></f:setPropertyActionListener>
</p:commandButton>
<br/>
</p:panelGrid>
On click of above button I try to load "newOrder.xhtml" file in the layout unit present in "customerHome.xhtml" file.

NOTE :
I have added CSP parameter in web.xml.
Primefaces version : 8.0
JSF api: 2.1
Server deployed in : Wildfly 8.0.Final

Case 1:
I have observed that If I remove onclick and onsuccess properties of above commandButton then I dont get the "Missing CSP nonce" exception in the jboss terminal , If I click on this button then the JSF screen just kind of freezes. I can see in the browser window that something is going on in background but on GUI nothing is visible and after some time the screen freezes.

Case2 :
I have observed that If I keep the onclick and onsuccess properties of above commandButton then , on click of this button i get "Missing CSP nonce" exception in the jboss terminal . The complete error is shown below:

Firefox GUI
https://drive.google.com/file/d/1sLxaEb ... p=sharing

Chrome GUI
https://drive.google.com/file/d/1W81CK ... p=sharing

Exception in wildfly terminal
https://drive.google.com/file/d/1uwoUF ... p=sharing


The files included in this are present at this link :
https://drive.google.com/file/d/1jJSLZ ... p=sharing

Please help me. I am stuck at this now.

Thanks

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

09 Jul 2020, 14:18

With all the issues you keep reporting that I keep proving work fine I think you should turn CSP OFF and get your app working first in 8.0 before you introduce CSP. You are having issues with your environment or you are including Jquery yourself or something weird. I have not been able to reproduce a single issue you have reported.

For example: viewtopic.php?f=3&t=62352

For example: posting.php?mode=reply&f=3&t=62609
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

s_kenkre
Posts: 28
Joined: 01 Apr 2020, 16:08

13 Jul 2020, 08:44

Hello,
My project is perfectly working fine and is deployed in Production but with primefaces 3.4.2 . Now I am working on migrating the same to primefaces 8.0.
I am not including or loading jquery myself. I have done all the changes mentioned in the migration guide but still I m facing these issues.

Thanks

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

13 Jul 2020, 13:34

well until you can create a standalone reproducible example like I keep providing I can't debug an issue that I cannot see.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: dan987, Google [Bot] and 30 guests