0

从 Wildfly 8 迁移到 16 和 Java 8 到 11 之后,我一直面临这个影响 JSFh:commandLinkf:ajax.

我试图渲染:mainform, mainform, @form... 但没有一个工作。我必须手动重新加载页面才能看到更改。

<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>

WF8 和 java 8 一切正常。

我该如何解决?

编辑:我尝试使用 Richfaces 和a4j:commandLink

<a4j:commandLink value="Click here" reRender="@form"  actionListener="#{bean.switchStatus}"/>

<a4j:commandLink value="Click here" render="@form" execute="@form" actionListener="#{bean.switchStatus}"/>

仍然没有渲染..状态已更改但页面表单未刷新。

编辑:经过一些研究,javascript渲染似乎是一个错误:当我删除此功能时渲染工作:

<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>
4

1 回答 1

0

现在,我已将所有 js CDATA 脚本移到表单之外,以便能够呈现它。

于 2019-05-15T10:45:12.957 回答