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 b开发者_开发技巧utton 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?
Let the bean action method navigate to a page which contains just the following.
<script>window.close();</script>
精彩评论