简体   繁体   中英

Close JSP popup window from within backing bean?

Currently, I have a commandButton element in my jsp declared like this:

 <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. 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.

I was wondering if I could close the popup inside the save method and leave the onclick event handler empty. Is it possible?

Is there a better way to close the window AFTER method save returns?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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