gpt4 book ai didi

javascript - SSJS 不在 xPage 上执行

转载 作者:行者123 更新时间:2023-11-29 15:23:50 25 4
gpt4 key购买 nike

我遇到了一些奇怪的问题。页面加载后第一次单击页面按钮时,页面按钮不会执行 SSJS。但是当您再次单击它时确实有效。我发现它尤其是当您清除浏览器缓存时。

  1. 尝试清除 Chrome 缓存(Ctrl+Shift+Del。清除所有内容)。
  2. 重新启动 Chrome。
  3. 尝试加载此页面 TEST.xsp。首先通过服务器登录页面。
  4. 点击“我的按钮”。它什么都不做。它应该是例如使用新参数重定向到同一页面,例如param1=true(确保它什么都不做,但只需将 param1=true 添加到 URL)
  5. 再次点击它。它确实有效

什么会导致这种行为?它可以是任何不完全是 context.redirectToPage 的 SSJS。但它仅在您第二次单击按钮时有效。在 FF 上发现了同样的问题,但它在 IE 中确实有效。

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:button id="button1" styleClass="btn btn-primary btn-sm"
value="My Button" title="My Button">
<span class="glyphicon glyphicon-edit"></span>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" id="eventHandler10">
<xp:this.action><![CDATA[#{javascript:context.redirectToPage("TEST.xsp?param1=true");}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>

这是我的应用配置选项: enter image description here enter image description here

最佳答案

当您将它放入 afterPageLoad 事件时,这确实有帮助。

if(!sessionScope.APP_LOADED){
sessionScope.put("APP_LOADED", true);
context.reloadPage();
}else if(sessionScope.APP_LOADED==false){
sessionScope.put("APP_LOADED", true);
context.reloadPage();
}

关于javascript - SSJS 不在 xPage 上执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41295576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com