After migrating from Wildfly 8 to 16 and Java 8 to 11, I've been facing this problem that affect JSF h:commandLink
and f:ajax
.
I tried to render :mainform
, mainform
, @form
... But none is working. I have to manually reload the page to see the changes.
<h:form id="mainform">
<div id="adiv">
...
<h:commandLink value="Change statut" styleClass="grey" rendered="#{not bean.condition}">
<f:ajax event="click" listener="#{bean.switchStatus}" execute="@this" render="@form" />
</h:commandLink>
</div>
</h:form>
Everything was right with WF8 and java 8.
How can I solve it ?
Edit: I tried with Richfaces and a4j:commandLink
:
<a4j:commandLink value="Click here" reRender="@form" actionListener="#{bean.switchStatus}"/>
and
<a4j:commandLink value="Click here" render="@form" execute="@form" actionListener="#{bean.switchStatus}"/>
Still no render.. Status is changed but page form is not refreshed.
Edit : After some research it seems to be an error with javascript rendering : Rendering works when I remove this function :
<script type="text/javascript">
//<![CDATA[
var interval;
function countDown(){
var countdown=$("#countdown");
var count=20;
if(interval){
clearInterval(interval);
}
interval=setInterval(function(){
count--;
if(count > 0) {
countdown.text(count);
} else {
clearInterval(interval);
interval=undefined;
$("#cancelLnk").remove();
}
},1000);
}
function onCancel(data){
if(data&&data.status=="begin"&&interval){
clearInterval(interval);
interval=undefined;
}
}
//]]>
</script>