webtier@glassfish.java.net

JSF2 jQuery and ajax

From: <webtier_at_javadesktop.org>
Date: Fri, 16 Apr 2010 16:21:14 PDT

I'm attempting to use the jQuery dialog in my JSF 2 application. I have a simple test page for the dialog. It looks like this:

                <h:outputScript library="js" name="popup.js" target="head" />
                    <h:form id="results">
                        <div id="popupTestDiv" class="ampPopup" style="display:none" >
                                Enter Something: <h:inputText id="popup" value="#{popupBean.textValue}" />
                                <h:commandButton action="#{popupBean.submit}" value="submit" >
                                    <f:ajax execute="results:popup" render="results:outputValue"/>
                                </h:commandButton>
                        </div>
                        Click here to enter a value:
                                <h:commandLink value="Click Me" >
                                    <adc:popup selector="#popupTestDiv" action="open" />
                                </h:commandLink>
                        You Entered: <h:outputText id="outputValue" value="#{popupBean.textValue}" />
                    </h:form>

popup.js is a javascript file that simply designates everything with the class ampPopup as a jQuery dialog
adc:popup is a ClientBehavior that has the simple code to open and close the popup.

Here are the results I get in my testing.

With dialog / with ajax = FAIL
With dialog / without ajax = OK
Without dialog / with ajax = OK
without dialog / without ajax = OK

It's a problem with the two playing together. In the case where it fails, the action for the commandButton is called, but the setter for the textValue is never called. In every other case, the setter for textValue is called and the action is called, as expected.

Thanks in advance for any input
Joel
[Message sent by forum member 'jweight']

http://forums.java.net/jive/thread.jspa?messageID=397490