【问题标题】:Javascript file included multiple times with JSF / Liferay 6.2JSF/Liferay 6.2 多次包含 Javascript 文件
【发布时间】:2018-11-12 15:29:59
【问题描述】:

我正在使用 Liferay 6.2 和 JSF 2.2.12

我有两个自定义 portlet(使用 Primefaces)。 我的 portlet 使用 <h:head /> 导入 Javascript 资源。 这些 portlet 显示在同一页面上。

在我的暂存环境中,primefaces.js 在渲染视图中包含一次:

<script src="https://example.com/group/my-site/url?p_p_id=portletone_WAR_portletone&...javax.faces.resource=primefaces.js...">

为什么我在生产环境中得到两个&lt;script&gt;

<script src="https://example.com/group/my-site/url?p_p_id=portletone_WAR_portletone&...javax.faces.resource=primefaces.js...">
<script src="https://example.com/group/my-site/url?p_p_id=portlettwo_WAR_portlettwo&...javax.faces.resource=primefaces.js...">

(与jquery.js 相同的观察结果)

【问题讨论】:

  • 您使用的是旧版本的 Liferay Faces 和 JSF。您应该升级到可以在liferayfaces.org 上找到的适当版本以避免安全漏洞。
  • yunandtidus 已经正确识别出 Liferay 6.2 的问题和解决方案,但人们应该意识到 Liferay 7.0+ 也可能出现类似问题:FACES-3175。我们已经在 Bridge Ext 5.0.3 中修复了这个问题,所以升级到那个版本应该可以解决这个问题。

标签: jsf primefaces liferay jsf-2.2


【解决方案1】:

这是由于 Liferay 并行渲染。为了禁用并行渲染,将以下属性添加到 portal-ext.properties

layout.parallel.render.enable=false

所有功劳归功于 Liferay 论坛上的 Neil Griffin: https://community.liferay.com/fr/forums/-/message_boards/message/20947470#_com_liferay_message_boards_web_portlet_MBPortlet_message_36195975

【讨论】:

    猜你喜欢
    • 2016-01-11
    • 1970-01-01
    • 1970-01-01
    • 2014-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多