Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.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
在JSF中是否可以通过ajax刷新页面?_Ajax_Jsf_Refresh_Page Refresh - Fatal编程技术网

在JSF中是否可以通过ajax刷新页面?

在JSF中是否可以通过ajax刷新页面?,ajax,jsf,refresh,page-refresh,Ajax,Jsf,Refresh,Page Refresh,我有这样的想法: <h:commandButton action="#{MyBean.action()}"> <f:ajax render ="@all"/> </h:commandButton> 是否可以替换ajax呈现中的“@all”以刷新页面 使用此代码,我的页面不会像按F5键一样刷新 这在ajax中是不可能的。只需删除,并发送一个重定向到self-in-action方法 <h:commandButton value="Submit a

我有这样的想法:

<h:commandButton action="#{MyBean.action()}">
   <f:ajax render ="@all"/>
</h:commandButton>

是否可以替换ajax呈现中的“@all”以刷新页面


使用此代码,我的页面不会像按F5键一样刷新

这在ajax中是不可能的。只需删除
,并发送一个重定向到self-in-action方法

<h:commandButton value="Submit and refresh" action="#{bean.action}" />
或者,如果您实际上不需要执行业务操作,只需使用
,而无需结果

<h:button value="Refresh only" />


@all刷新整个页面…还是您想要重定向?使用此代码,我的页面不会像按F5键一样刷新(从开发人员的角度来看)嗯,我从未使用过
@all
,但我确实觉得这与执行完全重定向几乎是一样的,但也有一些缺点,但基本内容可以刷新…(我知道ViewScope bean将在完全重定向中重新创建,这是主要区别之一,这与按f5相同)@Kukeltje:我在整个JSF生涯中遇到的
@all
唯一合理的真实世界用例是显示一个完整的错误页面,就像
FullAjaxExceptionHandler
那样(它是在封面下使用
PartialViewContext\setRenderal()
):-)因为我使用了omnifaces exceptionhandler,我不需要以任何方式使用
@all
。我真幸运
<h:button value="Refresh only" />