Return-Path: X-Original-To: apmail-myfaces-users-archive@www.apache.org Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 55736600D for ; Wed, 27 Jul 2011 18:10:32 +0000 (UTC) Received: (qmail 47823 invoked by uid 500); 27 Jul 2011 18:10:31 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 47777 invoked by uid 500); 27 Jul 2011 18:10:30 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 47769 invoked by uid 99); 27 Jul 2011 18:10:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 18:10:30 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gudnabrsam@gmail.com designates 209.85.220.181 as permitted sender) Received: from [209.85.220.181] (HELO mail-vx0-f181.google.com) (209.85.220.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 18:10:23 +0000 Received: by vxh17 with SMTP id 17so1573622vxh.12 for ; Wed, 27 Jul 2011 11:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=+AzDcTV2Msf4heMzHsRFVJ7HpynfTF7LSiwEfo8gnqQ=; b=m7dh2LFBTY0G5Fs2XPyXaeewyH0DMeryFhwL6wFHkQHpphHhP/EyGyzGFUJHsIY8J6 aeJ6iq0CzFCcbl5t7gKWl/Ct1r/wn8zx23l7F0K2zF/+Fn4Nx3vq2qJuB2n6G+8HMP0+ DKw3hLQSbogZ6SODbG7lyHtqOAU7LOE9koalM= MIME-Version: 1.0 Received: by 10.52.177.200 with SMTP id cs8mr142707vdc.72.1311790202623; Wed, 27 Jul 2011 11:10:02 -0700 (PDT) Received: by 10.52.108.232 with HTTP; Wed, 27 Jul 2011 11:10:02 -0700 (PDT) Reply-To: gudnabrsam@gmail.com In-Reply-To: <4E30524C.8040603@nnga.de> References: <4E30524C.8040603@nnga.de> Date: Wed, 27 Jul 2011 13:10:02 -0500 Message-ID: Subject: Re: An issue with converts and JSF2.0 CompositeComponents From: Matt Benson To: MyFaces Discussion Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, This looks like https://issues.apache.org/jira/browse/MYFACES-2552 where I have noted my workaround. HTH, Matt On Wed, Jul 27, 2011 at 1:00 PM, S. Bunge wrote: > Hi all, > > I got an issue using the composite components feature of jsf2.0. > It's quite possible that I'm using the feature the wrong way. > > I created such component to combine a label and an h:inputText. If I use > it with string objects all works fine but when I start to use instances o= f > custom classes and a converter registered in the faces-config.xml must > handle the object, it fails. > > I use MyFaces 2.0.7 with a tomcat 6.0.32. I removed the label and other > stuff in my example: > > My custom component (cc-ns: "http://java.sun.com/jsf/composite") > ... > > =A0 > =A0 > > > =A0 > > ... > > I named the file 'myCC.xhtml' in /resources/myComponents/ so I can use it > with ns-declaration: > 'xmlns:my=3D"http://java.sun.com/jsf/composite/myComponents"' in my facel= ets. > > I created also a bean named 'helloWorldBacking' with getMuh/setMuh and it > returns an Object of Type 'Muh'. A converter is registered in the > faces-config with 'converter-for-class' to handle the conversation betwee= n > view and model for the type. > > If I use > directly in my facelet it works like a charm. The converter is called and > get/set is called with the right object in the update model phase. But if= I > switch to the myCC-component I get an exception: > >> Caused by: javax.el.ELException: /resources/myComponents/myCC.xhtml at >> line 17 and column 62 value=3D"#{cc.attrs.value}": >> /helloWorld.xhtml at line 17 and column 71 >> value=3D"#{helloWorldBacking.muh}": Cannot convert asdfasd of type class >> java.lang.String to class elproblem.Muh >> =A0 =A0at >> org.apache.myfaces.view.facelets.el.TagValueExpression.setValue(TagValue= Expression.java:129) >> =A0 =A0at >> org.apache.myfaces.view.facelets.el.LocationValueExpression.setValue(Loc= ationValueExpression.java:120) >> =A0 =A0at javax.faces.component.UIInput.updateModel(UIInput.java:379) > > Maybe the behavior is slightly different with the used EL-library (I trie= d > jasper-el of the tomcat and EL2.2 of the glassfish) -- 'sometimes' it wor= ks > with none-null values the right way but if the bean returns 'null' if fai= ls > every time. > > My investigations came to a stop at following point: > _SharedRendererUtils#findUIOutputConverter doesn't get the outer value > binding of the composite component and can't determine the type. So no > converter is called and he tried to update > the model with a String. > If I set the type to the cc:attribute it doesn't work. That would be a ba= d > solution anyway because the composite component must be abstract > (otherwise I could call the right converter by id :-) ) > > So my questions: Do I use the composite components feature the right > way? If not: What is my fault? What are your suggestions? > > Thanks for your help, > Sven >