Ajax Partial rendering not working
p_ashwinram Oct 14, 2015 4:30 PMHi
We are migrating our application from Richfaces 3.3 to Richfaces 4.3.7.Final
The environment info is listed below:
<org.richfaces.bom.version>4.3.7.Final</org.richfaces.bom.version>
<jsf.version>2.1.26</jsf.version>
<seam.version>2.3.1.Final</seam.version>
Server: Jboss AS 7.1.1.Final
The a4j:commandButton and a4j:commandLinks are not partially rendering the page after the ajax call.
Here is a code example to reproduce the issue.
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head/>
<ui:define name="body">
<a4j:log mode="console" level="DEBUG" />
<h:outputStylesheet>
.outhello {
font-weight: bold;
word-break: break-all;
}
</h:outputStylesheet>
<h:form>
<h:panelGrid columns="3">
<h:outputText value="Facility Name:" />
<h:inputText value="#{facilitySearchConditionVO.name}" />
<a4j:commandButton value="Say Hello" render="out" execute="@form" action="#{searchFacility.findFacilites}" />
</h:panelGrid>
</h:form>
<br />
<h:panelGroup id="out">
<a4j:outputPanel id="out2">
<h:outputText value="Hello #{facilitySearchConditionVO.name} !" rendered="#{not empty facilitySearchConditionVO.name}" styleClass="outhello" />
</a4j:outputPanel>
</h:panelGroup>
</ui:define> | |||
</ui:composition>
I can see that the method #{searchFacility.findFacilites} gets executed and I can also confirm that the ajax response has some data. But the issue is that the partial response is not being rendered back and reflected on the page.
The debug console in my Chrome browser shows these messages:
RichFaces: New request added to queue. Queue requestGroupingId changed to j_idt5:j_idt9
log.js.seam?ln=org.richfaces:165 RichFaces: Queue will wait 0ms before submit
log.js.seam?ln=org.richfaces:165 RichFaces: richfaces.queue: will submit request NOW
log.js.seam?ln=org.richfaces:165 RichFaces: Received 'begin' event from <input id=j_idt5:j_idt9 ...>
jsf.js.seam?ln=javax.faces&stage=Development:1542 XHR finished loading: POST "http://localhost:8080/aces/test.seam".jsf.ajax.req.sendRequest @ jsf.js.seam?ln=javax.faces&stage=Development:1542request @ jsf.js.seam?ln=javax.faces&stage=Development:2046request @ richfaces.js.seam:646richfaces.queue.submitFirstEntry @ richfaces-queue.js.seam:278richfaces.queue.$.extend.onRequestDelayPassed @ richfaces-queue.js.seam:177richfaces.queue.$.extend.startTimer @ richfaces-queue.js.seam:199richfaces.queue.push @ richfaces-queue.js.seam:415jsf.ajax.request @ richfaces-queue.js.seam:39richfaces.ajax @ richfaces.js.seam:580onclick @ test.seam:15
log.js.seam?ln=org.richfaces:165 RichFaces: Received 'beforedomupdate' event from <input id=j_idt5:j_idt9 ...>
log.js.seam?ln=org.richfaces:165 RichFaces: [object Object]
log.js.seam?ln=org.richfaces:165 RichFaces: richfaces.queue: ajax submit error: An empty response was received from the server. Check server error logs.
log.js.seam?ln=org.richfaces:165 RichFaces: richfaces.queue: Nothing to submit
log.js.seam?ln=org.richfaces:165 RichFaces: Received 'error@emptyResponse' event from <input id=j_idt5:j_idt9 ...>logClassMethods.__log @ log.js.seam?ln=org.richfaces:165(anonymous function) @ log.js.seam?ln=org.richfaces:250richfaces.log.error @ richfaces.js.seam:269jQuery.ready.jsfAjaxLogAdapter @ log.js.seam?ln=org.richfaces:342richfaces.createJSFEventsAdapter @ richfaces.js.seam:456sendError @ jsf.js.seam?ln=javax.faces&stage=Development:1613response @ jsf.js.seam?ln=javax.faces&stage=Development:2227jsf.ajax.response @ richfaces.js.seam:656richfaces.queue.response @ richfaces-queue.js.seam:424jsf.ajax.response @ richfaces-queue.js.seam:50onComplete @ jsf.js.seam?ln=javax.faces&stage=Development:1435jsf.ajax.req.xmlReq.onreadystatechange @ jsf.js.seam?ln=javax.faces&stage=Development:1416
log.js.seam?ln=org.richfaces:165 RichFaces: [status=200] An empty response was received from the server. Check server error logs.logClassMethods.__log @ log.js.seam?ln=org.richfaces:165(anonymous function) @ log.js.seam?ln=org.richfaces:250richfaces.log.error @ richfaces.js.seam:269jQuery.ready.jsfAjaxLogAdapter @ log.js.seam?ln=org.richfaces:352richfaces.createJSFEventsAdapter @ richfaces.js.seam:456sendError @ jsf.js.seam?ln=javax.faces&stage=Development:1613response @ jsf.js.seam?ln=javax.faces&stage=Development:2227jsf.ajax.response @ richfaces.js.seam:656richfaces.queue.response @ richfaces-queue.js.seam:424jsf.ajax.response @ richfaces-queue.js.seam:50onComplete @ jsf.js.seam?ln=javax.faces&stage=Development:1435jsf.ajax.req.xmlReq.onreadystatechange @ jsf.js.seam?ln=javax.faces&stage=Development:1416
log.js.seam?ln=org.richfaces:165 RichFaces: Received 'complete' event from <input id=j_idt5:j_idt9 ...>
This is the response for the ajax request:
<?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id="out"><![CDATA[<span id="out"><span id="out2"><span class="outhello">Hello ashwin !</span></span></span>]]></update><update id="javax.faces.ViewState"><![CDATA[4326014007183483768:-4080198119431919733]]></update><extension id="org.richfaces.extension"><render>out</render></extension>
This is halting our migration efforts.
Can anyone please guide us on how to cross this hurdle?