【问题标题】:why does a4j:poll just work one time when I use it in my jsf page which is ui:defined with a template .xhtml为什么 a4j:poll 在我的 jsf 页面中使用它时只工作一次,该页面是 ui:defined with a template .xhtml
【发布时间】:2012-03-18 03:54:56
【问题描述】:

我创建了一个类似于richfaces-showcase main.xhtml的模板xhtml文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 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">
<f:view contentType="text/html">
    <h:head>
        <!-- Mimic Internet Explorer 8 -->
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"  />
        <title>My title</title>
    </h:head>
    <h:body>
        <div id="page">
            <ui:insert name="body">
                Body content missed
            </ui:insert>
        </div>
    </h:body>
</f:view>
</html>

在子页面中,我定义了“模板主体”,并在我的子页面中添加了一个 a4j:poll,我想用它每 5 秒刷新一次数据:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 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:rich="http://richfaces.org/rich"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition template="/templates/main.xhtml">
    <ui:define name="body">
        <h:form>
            <a4j:poll id="poll" interval="5000" enabled="true" action="..." render="poll,grid" />
        </h:form>        

        <h:form>
            <h:panelGrid columns="2" width="80%" id="grid">
                 sorry, details forgot ...
            </h:panelGrid>
        </h:form>
    </ui:define>
</ui:composition>

</html>

但问题是,当我在本地计算机上用 IE8 打开我的子页面时,a4j:poll 可以刷新一次数据,然后就再也无法获取数据了。当我在其他电脑上用 IE6 或 IE8 打开子页面时,它工作正常!有人能找出原因吗?提前致谢!!

【问题讨论】:

    标签: jsf-2 richfaces ajax4jsf


    【解决方案1】:

    我换了

    <h:head>
        <!-- Mimic Internet Explorer 8 -->
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"  />
        <title>My title</title>
    </h:head>
    

    <h:head>
        <!-- Mimic Internet Explorer 7 -->
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"  />
        <title>My title</title>
    </h:head>
    

    而且,它现在可以工作了……但是为什么呢?

    【讨论】:

      【解决方案2】:

      我让它与 EmulateIE8 一起工作。但可能在以 Intranet 方式使用它时,IE 会做不同的事情。

      检查您的浏览器模式和文档模式(按 F12)。

      我得到:IE9 / IE8 标准。

      【讨论】:

        猜你喜欢
        • 2015-06-21
        • 2014-06-21
        • 1970-01-01
        • 2014-01-02
        • 2010-12-31
        • 2015-10-22
        • 1970-01-01
        • 1970-01-01
        • 2012-04-07
        相关资源
        最近更新 更多