Forms 在其他窗口/选项卡中更新组件,而无需手动刷新
我有不同的页面和不同的布局,例如index.xhtml和user.xhtml,每个页面都有自己的模板。如果我在user.xhtml中做了更改,我想更新index.xhtml中的数据表 index.xhtml:Forms 在其他窗口/选项卡中更新组件,而无需手动刷新,forms,jsf-2,primefaces,commandbutton,Forms,Jsf 2,Primefaces,Commandbutton,我有不同的页面和不同的布局,例如index.xhtml和user.xhtml,每个页面都有自己的模板。如果我在user.xhtml中做了更改,我想更新index.xhtml中的数据表 index.xhtml: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f=
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/template.xhtml">
<ui:define name="body">
<h:form id="indexFormId">
<p:dataTable id="datalist" value="#{userController.items}"var="item" widgetVar="userWidget">
-----datatable columns and rows with user data------
</p:datatable>
</h:form>
-----包含用户数据的datatable列和行------
user.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/templateB.xhtml">
<ui:define name="body">
<h:form>
<p:commandButton value="Modify User" actionListner="some action" update=":thisForm, :indexFormId"/>
</h:form>
因此,当我关闭user.xhtml时,我看到index.xhtml数据表已更新,无需手动刷新。可能吗?有什么办法可以做到这一点?我发现有一种方法可以使用相同的模板来实现这一点。请参见以下选项中的
组件(定期服务器轮询)p:poll
- PrimeFaces Push(Atmosphere框架之上更通用的解决方案)