For example in PrimeFaces there is
RequestContext.getCurrentInstance().execute("alert(123)")
And in OmniFaces there is
Ajax.onComplete("alert(123)")
I tried the pure JSF options I got from:
- How would I call a JavaScript function from a JSF Bean?
- Initiating JavaScript call from server side
- How to return Javascript as partial response?
but neither of them works with Richfaces, specifically I'm either getting no alert in the response (using the first two options), or (using the last option) only the alert and an otherwise empty response with the follwing error in the browser console:
JSF AJAX Error:
description: "An empty response was received from the server. Check server error logs.",
responseCode: 200,
responseText: "<?xml version='1.0' encoding='UTF-8'?>?<partial-response><changes><eval><![CDATA[alert(123);]]></eva??l>",
responseXML: null
How can I just pass some JavaScript to the browser from Java code using RichFaces?
Thanks