java - a4j :commandLink stops working after being reRender

标签 java jsf richfaces

我创建了这个测试用例来隔离我的问题。一旦轮询执行 ajax 更新,a4j:commandLink 操作就不会执行。如果我们在轮询的重新渲染之前关闭 modalPanel,它就会被执行。

有什么建议吗?提前致谢。

测试.xhtml:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fnc="http://eyeprevent.com/fnc">
<a4j:outputPanel id="testing">
<rich:modalPanel id="examinationPanel" autosized="true" width="450" rendered="#{test.condition2}">
    <f:facet name="header">
        <h:outputText value="View Examination Images" />
    </f:facet>
    <f:facet name="controls">
        <h:panelGroup>

            <a4j:form>

                <a4j:commandLink action="#{test.close}">
                    <h:graphicImage value="/images/modal/close.png" id="hideExaminationPanel" styleClass="hidelink" />
                </a4j:commandLink>
            </a4j:form>
            <rich:componentControl for="examinationPanel" attachTo="hideExaminationPanel" operation="hide" event="onclick" />

        </h:panelGroup>
    </f:facet>


    <a4j:form>

        <h:panelGrid columns="1" id="timeoutText">
            <h:outputText id="remainingtime" value="condition1" rendered="#{test.condition1}" />
            <h:outputText id="timer" value="condition2" rendered="#{test.condition2}" />

        </h:panelGrid>

        <a4j:poll id="poll" interval="5000" enabled="#{test.poll}" reRender="poll,timeoutText" />



    </a4j:form>
</rich:modalPanel>

关联

测试对象.java

import org.apache.log4j.Logger;
public class TestBean {
private boolean condition1=false;
private boolean condition2=true;
private boolean poll=true;

public void close(){
Logger.getLogger("com.eyeprevent").info("here!");
poll=false;
condition1=true;
condition2=false;

}

public boolean isCondition1() {
return condition1;
}

public void setCondition1(boolean condition1) {
this.condition1 = condition1;
}

public boolean isCondition2() {
return condition2;
}
public void setCondition2(boolean condition2) {
this.condition2 = condition2;
}
public boolean isPoll() {
return poll;
}
public void setPoll(boolean poll) {
this.poll = poll;
}
} 

TestBean 是 session 范围的。 Richfaces 版本 3.3.2.SR1

并且在 Chrome 5.0.322.2 dev 中也没有出现 modalPanel。它在 FF 和 IE7 下运行。

最佳答案

尝试以下任意组合:

  • 移动<a4j:form>在模态面板之外
  • 设置domElementAttachment (模态面板的)属性为 formparent
  • 尝试使用 <h:form>

尝试以下而不是 <a4j:commandLink> :

<h:graphicImage value="/images/modal/close.png" styleClass="hidelink"
            onclick="#{rich:component('examinationPanel')}.hide()" id="close" />

并使用onhide="notifyClose()"modalPanel 上, 其中notifyClose()使用 <a4j:jsFunction> 定义.这是一种解决方法,但可能会奏效。

关于java - a4j :commandLink stops working after being reRender,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2326509/

相关文章:

java - Eclipse 智能感知信息

java - 用 Java 下载整个 FTP 目录 (Apache Net Commons)

jsf - 从母版页关闭后销毁primefaces对话框中的数据

jsf - 使用 JSF 应用程序下载日志文件?

java - 在 Eclipse 应用程序中安装时,找不到 Eclipse plugin.xml 文件中的国际化字符串

java - Android 中 undefined reference native 库

java - 无法在 <p :inputNumber/> control of primefaces 中显示印度货币格式(##、##、###.##)

java - 意见箱性能问题

jsf - 拦截 a4j :commandButton request

java - 如何仅在未渲染另一个组件时才渲染一个组件?