【发布时间】:2015-06-19 11:01:59
【问题描述】:
在我的 JSF 1.2 应用程序中,我使用 trinidad 扩展服务 addscript 功能来调用 javascript 函数。
我可以从以下 javascript 控制台日志中看到正在调用 js 方法。 但是没有生成 POST 请求。 页面中有许多其他(正常)按钮可以正常工作。 我的控制台中没有 JS 错误。我已确保所有包含的页面都没有任何表单,这是唯一的表单。
我最头疼的是,它在我的本地工作区中运行良好,而且我只有在直接点击我的应用程序 URL 时才会遇到问题。这发生在所有 IE 版本中。
有人可以建议可能是什么问题吗?
在 Bean 中:
FacesContext facesContext = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(
facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, “clickHiddenButton();”);
Javascript:
function clickHiddenButton () {
if(null != console)
console.log('before calling hidden button for close');
document.getElementById('hiddenButton').click();
if(null != console)
console.log('after calling hidden button for close');
}
我的页面隐藏按钮组件:
<tr:commandButton id="hiddenButton" action="#{bean.actionHidden}" immediate="true"></tr:commandButton>
【问题讨论】:
-
是的,我做的第一件事!
-
您似乎暗示它仅发生在 IE 中,而不发生在其他浏览器(Chrome、Firefox 等)中。这是真的吗?
-
不,实际上我们的应用程序不支持任何其他浏览器,所以我只能检查所有 IE 版本。
-
您的 JavaScript 暗示您在表单上使用
prependId="false"。这是真的吗?
标签: javascript jsf trinidad