Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 在其他窗口/选项卡中更新组件,而无需手动刷新_Forms_Jsf 2_Primefaces_Commandbutton - Fatal编程技术网

Forms 在其他窗口/选项卡中更新组件,而无需手动刷新

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=

我有不同的页面和不同的布局,例如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="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框架之上更通用的解决方案)

关闭表示浏览器关闭事件或会话无效(注销)?我有一个浏览器会话,打开了两个或多个选项卡。因此,当我修改选项卡中的某些内容时,我希望更新其他选项卡中的某些值。这可能吗?我知道,如果两个选项卡具有相同的布局,则有一种方法是可行的@我知道一种方法是使用websocket或类似工具。谢谢