Primefaces: RequestContext.execute - Javascript called twice
Asked Answered
C

3

6

I'm using primefaces and have a problem executing JavaScript at the end of an ajax call. I add some action to the RequestContext, and it is executed twice!

RequestContext.getCurrentInstance().execute("alert('I'm here!')");

It is also embedded twice in the XML which I get back from the server - two times the same component and same node.

Primefaces Version is 5.3.10

Any ideas what is going wrong here? Thanks.

Contemptible answered 15/4, 2016 at 9:29 Comment(6)
endDocument in PrimePartialResponseWriter is also called twice. It contains a call to encodeScripts which returns the <eval> nodes...Contemptible
minimal reproducible example and stackoverflow.com/tags/jsf/infoVanadous
OK, it seems that it was a deployment-problem. We deployed it again and the problem is solved...Contemptible
Then please either remove the question or create this as an answerVanadous
I have the same problem when calling the execute method from a p:commandButton. It doesn't happen when calling it in the @PostConstruct method.Cleanshaven
I have exactly same problem but after redeploy also problem not solvedChive
C
-4

OK, it seems that it was a deployment-problem. We deployed it again and the problem is solved...

Contemptible answered 20/4, 2016 at 6:37 Comment(0)
B
4

It has been a while since last answer and problem seems to be solved but I believe I know what is going on and the reason new deployment solved the problem.

It seems it happens when you have more than one primefaces*.jar inside EAR (i.e. EAR/lib and WAR/WEB-INF/lib.

If anyone else is facing this problem, try to remove from EAR/lib (or EAR root), keep only one primefaces*.jar in EAR.

Bloodthirsty answered 22/6, 2017 at 16:12 Comment(0)
L
0

I avoided such error by changing version of Primefaces from 6.0 to 6.1 in POM. (6.1 version was in libs of server Payara)

Lentamente answered 12/2, 2018 at 10:52 Comment(1)
So effectively you also made sure there is just one PrimeFaces version? But which is used?Vanadous
C
-4

OK, it seems that it was a deployment-problem. We deployed it again and the problem is solved...

Contemptible answered 20/4, 2016 at 6:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.