Hi!
I have custom JSF component that I am trying to adapt for use under AJAX4JSF/RichFaces.
The component is a wrapper around ActiveX control fed with data through
JavaScript.
The original plain JSF version of the component emits HTML OBJECT tag and also
JavaScript code to activate the object and initialize it with data to display.
I am trying to modify the control so that whenever data update is done inside
AJAX request, only a delta of the data is sent back instead of the whole data
set.
Another important piece is to avoid reinstantiating the ActiveX control so
as to avoid a flicker.
Thus what I want to do is roughly:
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
if (! ajaxContext.isAjaxRequest())
{
// full repaint
... emit HTML tag for ActiveX object ...
... emit JavaScript code to load the control with initial data ...
}
else
{
// delta update
... emit JavaScript for partial update of data inside ActiveX control ...
}
The first part (non-AJAX request) works fine. ActiveX control gets
instantiates and loaded with initial data.The second part does not work. It appears that JavaScript code emited in
response to AJAX request does not get executed at all inside the browser.I can verify with HTTPWatch that the browser does indeed receive a response
from the server that includes valid JavaScript code, however this code does not
get executed.As a matter of fact, even simple script containing alert() statement I tried
to send back does not get executed.Something like this:
{script type="text/javascript"}//<![CDATA[
alert('About to execute DELTA update!');
//]]}{/script}
(NB: I replaced tag brackets with {} for purposes of posting to this board.)
does not display an alert.
Is AJAX4JSF supposed to handle and execute JavaScript code sent back by the
server in response to AJAX request?If yes, why it may fail to work in this particular case?I am using the latest stable build of RichFaces.Thanks,
Sergey