There are different approaches, but it can be done. The easiest way is to
set the target of the command button to a new window. Then the action method
can be responsible for loading a popup page in that window. I avoid popups
like the plague because of browser blocking, opening in window vs. tab, etc.
In those cases it would be better to use a light weight popup solution (see
trinidad or tomahawk popup).

If those still aren't what you want, you can use ajax to have your button
invoke a method on the server then send down some javascript that will open
the window. The AJAX will allow you to avoid refreshing the current page
when the button is clicked. Implementation details would be different based
on which AJAX library you go with.

Jenia4Faces also has an IFRAME based popup solution that may be what you
want if you don't need a new window:

http://www.jenia.org/

-Andrew

On Jan 24, 2008 12:13 PM, bansi <[EMAIL PROTECTED]> wrote:

>
> I have a requirement where i wanna execute both Method Binding and
> JavaScript
> Code at the same time using JSF h:commandButton.
>
> The Javascript will open a popup while MethodBinding will set the values
> in
> Backing Bean
>
> Here is the snippet
> <h:commandButton id="findContact" value="Manage Contacts" immediate="true"
>    onmousedown="createPopUp('contactLookup','find')"
>    onclick="return false" image="/images/contacts.gif" border="0"
> alt="Click here to Manage Contacts"
>    actionListener="#{contactBean.getFormVariables}">
>         <f:attribute name="formName" value="deviceForm" />
>        <f:attribute name="fieldName" value="contact" />
>
>    </h:commandButton>
>
> Any pointers/suggestions will be highly appreciated
> --
> View this message in context:
> http://www.nabble.com/Is-it-possible-for-JSF-h%3AcommandButton-to-execute-MethodBinding-and-JavaScript-tp15072394p15072394.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Reply via email to