JSF2 - Primefaces onbeforeunload和更新页面内容(uicomponent)

时间:2016-05-06 13:04:56

标签: jsf-2 primefaces onbeforeunload

在primefaces应用程序中,如果他们在没有提交的情况下离开表单,我需要警告用户。

我使用模板,导航几乎完全是通过更改主区域的内容完成的。

模板:

<h:panelGroup id="mainForm" layout="block">
    <ui:insert name="content" />
</h:panelGroup >

模板客户端:

<ui:define name="content"> <ui:include src="pages/#{appView.content}.xhtml" /> </ui:define>

和支持bean:

RequestContext context = RequestContext.getCurrentInstance();
appView.setContent("some_page");
context.update("mainForm");

我已经看过使用“onbeforeunload”的解决方案,但它只会在用户离开整个页面时触发,而不是在区域内容更新时触发。

任何指针都会非常感激

0 个答案:

没有答案