0

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>
  • Possible duplicate of [Ajax update/render does not work on a component which has rendered attribute](https://stackoverflow.com/questions/14790014/ajax-update-render-does-not-work-on-a-component-which-has-rendered-attribute) – Kukeltje May 15 '19 at 08:57

1 Answers1

0

For now, I've moved all js CDATA scripts outside form to be able to render it.