开发者

Close JSP popup window from within backing bean?

开发者 https://www.devze.com 2023-02-08 08:04 出处:网络
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();\

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

精彩评论

暂无评论...
验证码 换一张
取 消