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?

[4858 byte] By [llea] at [2007-10-3 9:16:59]
# 1

Try to upgrade MyFaces to 1.1.5 or downgrade Ajax4jsf to 1.0.2 from:

https://ajax4jsf.dev.java.net/servlets/ProjectDocumentList?folderID=5244&expandFolder=5244&folderID=0

MyFaces 1.1.3(4) and ajax4jsf 1.0.3 does not work together very well. We has been reported about the problem you met already.

Sergey.Smirnova at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thank you for your response.Do you know where can I get Myfaces v1.1.5? on myfaces site, version 1.1.4 is the latest.Also, does it mean i also need to upgrade Tomahawk to newer version?again, thanks.
llea at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Did you try Ajax4jsf 1.0.2 already ?
Sergey.Smirnova at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Yes I have and it worked with Ajax4jsf 1.0.2.Thanks a lot for your help.
llea at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Sergey

How about Ajax4Jsf version 1.0.4 as i dont want to register Facelets 1.1.12 View Handler in web.xml . But will it work with MyFaces 1.1.4

Also please tell me the correct stack of versions . Is this correct?

- MyFaces 1.1.4

- Facelets 1.1.12

- Ajax4Jsf 1.0.4

Regards

Bansi

mail2bansia at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
latest stable version is 1.0.6rc2 . If you does not care about the bug fixes and new introduced feature between those two version, this stack is correct
Sergey.Smirnova at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

can anyone guide me through how to setup tomahawk and myfaces with tomcat 6 or tomcat 5.5. I can get the components to display but when i try to add a EL expression within the value of any of the elements e.g.:

<t:InputDate value="sample.date" /> I get a Attribute not declared in TLD exception.

Can anyone guide me PLEASE!!!

gefunka at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

correction of code on above post:

_

can anyone guide me through how to setup tomahawk and myfaces with tomcat 6 or tomcat 5.5. I can get the components to display but when i try to add a EL expression within the value of any of the elements e.g.:

<t:InputDate value="#{sample.date}" /> I get a Attribute not declared in TLD exception.

Can anyone guide me PLEASE!!!

gefunka at 2007-7-15 4:29:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...