如何在 Liferay 7 中禁用 SennaJS/SPA?

How can I disable SennaJS/SPA in Liferay 7?

Liferay 7 使​​用 SennaJS 作为其单页应用程序引擎,以便在表单提交和导航期间加载和替换门户页面的某些部分。有时此功能会干扰我的用例,那么如何禁用它?

如果您想禁用由 SennaJS 执行的 XHR GET 导航或其对表单提交的处理,您可以尝试以下操作之一:

  • 如果您只想为某些表单或链接禁用 SPA,您可以将 data-senna-off="true" 属性添加到那些 <form><a> 标签。

  • 如果您只想为一个 portlet 禁用 SPA,您可以将 <single-page-application>false</single-page-application> 添加到 liferay-portlet.xml[的 <portlet> 部分(参见 the DTD for the expected order of liferay-portlet.xml elements)。

  • 如果您只想为一个 OSGi 模块 portlet 禁用 SPA,您可以将 "com.liferay.portlet.single-page-application=false" 添加到您的 portlet 元数据中。

  • 如果您想在整个门户网站范围内禁用 SPA,您可以将 javascript.single.page.application.enabled=false 添加到您的 portal-ext.properties 文件中。