Myfaces and Ajax4JSF
Hi,
I tried to use ajax4jsf in my login page, which basically changes the value of the applist select menu when the value of the hostlist select menu is changed.
Here is the jsf:
<a4j:log hotkey="M" />
<t:div id="contentArea" forceId="true">
<h:form id="form1"><h:outputText value="Please enter your name and password:" styleClass="normalTextStyle" id="text1"/>
<h:panelGrid columns="2" id="grid1">
<h:outputText value="Name:" id="text2"/>
<h:inputText value="#{user.persistentUser.userName}" id="text3"/>
<h:outputText value="Password:"/>
<h:inputSecret value="#{user.persistentUser.userPassword}" id="text4"/>
<h:outputText value="Host:" id="text5"/>
<h:selectOneMenu value="#{user.host}" id="hostlist">
<a4j:support action="#{user.hostChanged}" event="onchange" reRender="applist"/>
<f:selectItems value="#{user.hostList}"/>
</h:selectOneMenu>
<h:outputText value="Application:" id="text6"/>
<t:selectOneMenu id="applist" forceId="true" value="#{user.persistentUser.hostApp.id}">
<f:selectItems value="#{user.appList}"/>
</t:selectOneMenu>
</h:panelGrid>
<h:commandButton action="#{user.verifyUser}" value="Login"/>
</h:form>
</t:div>
Here is the log from popup window when I select a different host:
debug[15:39:56,499]: NEW AJAX REQUEST !!! with form :body:form1
debug[15:39:56,515]: parameter body:form1:_idJsp3 with value body:form1:_idJsp3
debug[15:39:56,515]: Start XmlHttpRequest
debug[15:39:56,515]: Reqest state : 1
debug[15:39:56,515]: QueryString: AJAXREQUEST=_viewRoot&body%3Aform1%3Atext3=&body%3Aform1%3Atext4=&body%3Aform1%3Ahostlist=host2&body%3Aform1_SUBMIT=1&autoScroll=&jsf_sequence=2&body%3Aform1%3A_idJsp3=body%3Aform1%3A_idJsp3&
debug[15:39:56,515]: Reqest state : 1
debug[15:39:56,593]: Reqest state : 2
debug[15:39:56,593]: Reqest state : 3
debug[15:39:56,593]: Reqest state : 4
debug[15:39:56,593]: Reqest end with state 4
debug[15:39:56,593]: Response with content-type: text/xml;charset=UTF-8
debug[15:39:56,593]: Full response content: <?xml version="1.0"?> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><meta name="Ajax-Update-Ids" content="" /><meta id="Ajax-Response" name="Ajax-Response" content="true" /><script type="text/javascript" src="/riskapp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf"> </script></head><body><span id="ajax-update-ids"><input type="hidden" name="jsf_sequence" value="3" /></span><!-- MYFACES JAVASCRIPT --> <script type="text/javascript"><!-- function getScrolling() { var x = 0; var y = 0; if (self.pageXOffset || self.pageYOffset) { x = self.pageXOffset; y = self.pageYOffset; } else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop)) { x = document.documentElement.scrollLeft; y = document.documentElement.scrollTop; } else if (document.body) { x = document.body.scrollLeft; y = document.body.scrollTop; } return x + "," + y; } //--></script> </body></html>
debug[15:39:56,609]: Header Ajax-Update-Ids not found, search in <meta>
debug[15:39:56,609]: search for elements by name 'meta' in element #document
debug[15:39:56,609]: getElementsByTagName found 2
debug[15:39:56,609]: Find <meta name='Ajax-Update-Ids' content=''>
warn[15:39:56,609]: No information in response about elements to replace
debug[15:39:56,609]: call getElementById for id= ajax-update-ids
debug[15:39:56,609]: Hidden JSF state fields: [object HTMLSpanElement]
debug[15:39:56,609]: search for elements by name 'input' in element span
debug[15:39:56,609]: getElementsByTagName found 1
debug[15:39:56,609]: Replace value for inputs: 7 by new values: 1
debug[15:39:56,609]: Input in response: jsf_sequence
debug[15:39:56,609]: Found same input on page with type: hidden
debug[15:39:56,609]: search for elements by name 'INPUT' in element span
debug[15:39:56,609]: getElementsByTagName found 0
debug[15:39:56,609]: Replace value for inputs: 7 by new values: 0
-
It seems that the ajax call was made to the server. However, the applist component is not rerendered.
I used Myfaces 1.1.4, Tomahawk 1.1.3 (even downgrading myfaces to 1.1.3 still doesn't work), and Tomcat 5.5.
Any idea why the component is not rerendered correctly?

