Close JSP popup from inside bean?

I currently have a commandButton element in my jsp declared as follows:

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

After clicking this button, the bean support method will be called and the popup will be closed. I do not want them to pass simultaneously. When I click the button, I prefer to call the save method first and close the window after the method returns.

I was wondering if I can 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 Return AFTER method window?

+3
source share
1 answer

Let the bean action method go to a page containing only the following.

<script>window.close();</script>
+4
source

Source: https://habr.com/ru/post/1789555/


All Articles