Button submit with no page refresh

I want to have a <h:commandButton..> button, upon clicking this button, particular action specified should be called and form should not be submitted and existing window should be closed. Please any help.
[217 byte] By [raghu182a] at [2007-10-2 20:30:08]
# 1

If you look at the html source a h:commandButton creates, it is creating a form submit button (type="submit") which will always submit the form/page.

If you want a button that doesn't submit the page, you probably don't want a h:commandButton. You could create your own custom component that creates html like:

<input type="button" onclick="put javascript here to close the other window" />

Or alternatively, just use plain html for this button and surround it in <verbatim> </verbatim> tags.

mpfigga at 2007-7-13 23:13:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Here my action should be executed as well. So any other solution.Thanks,Raghu
raghu182a at 2007-7-13 23:13:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

If by action you are talking about a method in the backing bean, then it will require a page submit.

Another way to get a command button to not submit:

<h:commandButton value="test" onclick="closeWindow();return false;" />

If you want the command button to perform an action, ie something like:

<h:commandButton value="test" action="#{someBackingBean.someMethod}" />

then it will *require* a page submit as the backing bean method code is on the web server, not the user's web browser. There's no way around it.

mpfigga at 2007-7-13 23:13:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...