RF 4.5.14 - a4j:jsFunction - onbeforedomupdate and oncomplete not invoked
m.a.knapp Mar 18, 2016 12:47 PMRF 4.5.14 / JSF 2.2.8 / Wildfly 8.2
If have the problem that onbeforedomupdate and oncomplete on a4j:jsfunction are not invoked:
test.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns = "http://www.w3.org/1999/xhtml"
xmlns:a4j = "http://richfaces.org/a4j"
xmlns:rich = "http://richfaces.org/rich"
xmlns:h = "http://java.sun.com/jsf/html"
xmlns:f = "http://java.sun.com/jsf/core"
>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body style="text-align:center;" >
<h:form>
<a4j:jsFunction
name="testCall"
data="#{test.data}"
onbeforedomupdate="jQuery('#domupdate').html(data)"
oncomplete="jQuery('#complete').html(data)"
action="#{test.test}"
>
<a4j:param name="test" />
</a4j:jsFunction>
</h:form>
<div id="domupdate" >
---
</div>
<div id="complete" >
---
</div>
<script>
testCall('hello world !');
testCall('hello world 2 !');
</script>
</h:body>
</html>
TestBean.java
package com.j4care.viewer.web.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
@ManagedBean(name="test")
@RequestScoped
public class TestBean
{
private String data;
public synchronized void test()
{
final FacesContext context = FacesContext.getCurrentInstance();
this.data = context.getExternalContext().getRequestParameterMap().get("test");
System.out.println("test called: " + data);
}
public String getData()
{
System.out.println("getData called: " + data);
return data;
}
public void setData(String data)
{
this.data = data;
}
}
Server log:
17:41:36,481 INFO [stdout] (default task-101) getData called: null 17:41:36,481 INFO [stdout] (default task-101) getData called: null 17:41:36,482 INFO [stdout] (default task-101) test called: hello world ! 17:41:36,482 INFO [stdout] (default task-101) getData called: hello world ! 17:41:36,542 INFO [stdout] (default task-102) getData called: null 17:41:36,542 INFO [stdout] (default task-102) getData called: null 17:41:36,542 INFO [stdout] (default task-102) test called: hello world 2 ! 17:41:36,543 INFO [stdout] (default task-102) getData called: hello world 2 !
HTTP Reqest/Response
j_idt5=j_idt5&javax.faces.ViewState=2822162167152350826%3A-3117259642620583857&javax.faces.source=j_idt5%3Aj_idt6&javax.faces.partial.execute=j_idt5%3Aj_idt6%20%40component&javax.faces.partial.render=%40component&test=hello%20world%20!&org.richfaces.ajax.component=j_idt5%3Aj_idt6&j_idt5%3Aj_idt6=j_idt5%3Aj_idt6&rfExt=null&AJAX%3AEVENTS_COUNT=1&javax.faces.partial.ajax=true