简体   繁体   English

从支持bean中关闭JSP弹出窗口?

[英]Close JSP popup window from within backing bean?

Currently, I have a commandButton element in my jsp declared like this: 目前,我在我的jsp中有一个commandButton元素,声明如下:

 <h:commandButton id="saveButton" value="Save" type="submit" action="#{backingbean.save}" onclick="window.close();" />

Once this button is clicked, the backing bean method will be called and the popup window will be closed. 单击此按钮后,将调用backing bean方法并关闭弹出窗口。 I don't want them to take place simultaneously. 我不希望它们同时发生。 Upon button click, I'd rather call the save method first and close the window once the method returns. 点击按钮后,我宁愿先调用save方法,一旦方法返回就关闭窗口。

I was wondering if I could close the popup inside the save method and leave the onclick event handler empty. 我想知道是否可以在save方法中关闭弹出窗口并将onclick事件处理程序留空。 Is it possible? 可能吗?

Is there a better way to close the window AFTER method save returns? 是否有更好的方法关闭窗口AFTER方法保存返回?

让bean动作方法导航到只包含以下内容的页面。

<script>window.close();</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM