users@woodstock.java.net

Re: Woodstock with Facelets AJAX woes

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Fri, 18 Jan 2008 20:18:13 -0500

The Woodstock components are based on JSF 1.2 and support the
javax.el.MethodExpression APIs. As of Woodstock 4.0, tag attributes such
as "action", "actionListener", and "validator" have been replaced with
"actionExpression", "actionListenerExpression", "validatorExpression",
etc. If I'm not mistaken, Facelets relies on the deprecated
javax.faces.el.MethodBinding APIs of JSF 1.1. Therefore, the components
can only be used in Facelets, if you use the older APIs. That is, the
deprecated setAction, setActionListener, and setValidator methods
inherited from JSF.

That said, instead of using the validatorExpression property, try
setting the validator property.

Dan

Kenneth Suter wrote:
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>