Jsf 2 为什么a4j:poll在我的jsf页面中使用时只起一次作用,而我的jsf页面是用template.xhtml定义的ui:
我创建了一个类似于richfaces showcase main.xhtml的模板xhtml文件:Jsf 2 为什么a4j:poll在我的jsf页面中使用时只起一次作用,而我的jsf页面是用template.xhtml定义的ui:,jsf-2,richfaces,ajax4jsf,Jsf 2,Richfaces,Ajax4jsf,我创建了一个类似于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.c
<!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打开子页面时,它工作正常!有人能找出原因吗?提前谢谢 我更改了
<h:head>
<!-- Mimic Internet Explorer 8 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<title>My title</title>
</h:head>
我的头衔
到
我的头衔
而且,它现在起作用了。。。但是为什么呢?我用EmulateIE8实现了它。但当以内联网的方式使用它时,IE可能会有不同的做法 检查浏览器模式和文档模式(按F12) 我得到了:IE9/IE8标准
<h:head>
<!-- Mimic Internet Explorer 7 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>My title</title>
</h:head>