users@woodstock.java.net

Woodstock with Facelets AJAX woes

From: Kenneth Suter <Kenneth.Suter_at_Sun.COM>
Date: Fri, 18 Jan 2008 14:46:26 -0600

Hello,

I am trying to get AJAX validation to work using Woodstock 4.1 and
Facelets 1.1.13, by setting the 'autoValidate=true' property along with
a validatorExpression whose value is a method in a bean on the server.
I know it has recently been discovered that there are problems with
Facelets and Woodstock so if these problems are due to known issues let
me know. There seems to be at least two problems that I am having:

1) The method expression value of the validationExpression property for
webuijsf:textField is never applied to the WebuiInput's
validatorExpression class. When I step through the source code I can
see that the Facelets view handler does end up calling
Field.setValueExpression and the expression ends up being added to
UIComponent's 'bindings' variable. However when the Java code is asked
to validate the value from the AJAX request by invoking
WebuiInput.validateValue(), the result of the call to
getValidatorExpression() is null and sot he method referred in the
expression is never called.

2) In the browser, after the response from the AJAX call is returned an
error appears in the JavaScript console for com_sun_faces_ajax-max.js
line 923: 'components has no properties'. The context of this error is
the following in prototype.js:

renderView: function(xjson) {
912 var xml = this.transport.responseXML;
913 var id, content, markup, str;
914 if (null == xml || typeof xml == 'undefined') {
915 // If the content contains javaScript, just execute it
916 markup = this.transport.responseText;
917 if (null != markup && typeof markup != 'undefined') {
918 markup.evalScripts();
919 }
920 return;
921 }
922 var components = xml.getElementsByTagName('components')[0];
923 var render = components.getElementsByTagName('render');
...

In this case, the transport value contains a
'this.transport.responseText' of:

<partial-response><components><render
id="profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"><markup><![CDATA[{"valid":true,"id":"profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"}]]></markup></render></components><partial-response><components><render
id="profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"><markup><![CDATA[{"valid":true,"id":"profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"}]]></markup></render></components>

but the 'this.transport.responseXML' contains a parsererror:

XML Parsing Error: no element found
Location: http://localhost:8080/idm/faces/profile.xhtml
Line Number 1, Column 735:

I've verified that in the webui-jsfx.js's function
'processValidationEvent', the 'domNode' variable is correctly populated.

<partial-response><components><render
id="profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"><markup><![CDATA[{"valid":true,"id":"profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"}]]></markup></render></components><partial-response><components><render
id="profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"><markup><![CDATA[{"valid":true,"id":"profile_form:ContentPageTitleProfile:PropertySheetProfile:SectionAccountAttributes:PropertyEmailAddress:TextFieldEmailAddress"}]]></markup></render></components>

So I suppose the XML returned by the request is distasteful somehow (the
![CDATA[?) to the parser. Any help would be appreciated.

-Kenneth