myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Uribe <lu4...@gmail.com>
Subject Re: Problem with composite components and tag handler
Date Mon, 26 Mar 2012 20:42:42 GMT
Hi

Difficult question. You should avoid that trick, or at least use c:if
inside you custom tag to make it work properly. Really there are some
details that will not work as expected.

First of all, <c:if> code has changed since the original code inside
facelets, to ensure proper operation with JSF 2.0 Partial State
Saving. It is very complex to explain, but in resume, no component
like c:if can be created without rely in some implementation details.

The second part is composite component algorithm cannot recognize the
tag as a tag containing component instances, so if the composite
component uses cc:insertChildren, the part related to the tag will not
be applied correctly. The solution in this case is use a composite
component or a normal component instead a facelets user tag. Anyway,
maybe we can do something better in this part (
org.apache.myfaces.view.facelets.tag.composite.CompositeComponentResourceTagHandler),
and try to detect better cases like the one described here.

regards,

Leonardo Uribe

2012/3/26 Dennis Hörsch <hoersch@his.de>:
> Hey,
>
> I have a problem with composite components. The scenario is as follows:
>
> <his:someCompositeComponent id="outer">
>     <h:inputText id="first" ... />
>
>     <his:someTagHandlerTag condition="bla">
>         <h:inputText is="second" ... />
>     </his:someTagHandlerTag>
> </his:someCompositeComponent>
>
> The problem is, only the first input field is rendered. The second is not.
> After building the component tree, the first is a child of the 'composite
> component'-facet of the surrounding UINamingContainer (outer), the second
> ends as child of the UINamingContainer. The 'HtmlCompositeComponentRenderer'
> renders only the children of the facet.
>
> The 'someTagHandlerTag' is handled by a subclass of TagHandler. If the
> condition is true, it calls the nextHandler (second-input field) which adds
> the input as child to the composite component.
>
> It is the same with the JSTL-Tags: If I have a 'c:if' inside a composite
> component, it will not be rendered in any case.
>
> Is this how it should be? Or should this tags also be rendered (handled) as
> childs using composite components?
>
> I hope that I could clarify the problem :-)
>
> Thank you,
> dennis hoersch
>
>
>
> --
>
> HIS Hochschul-Informations-System GmbH
> Goseriede 9 | 30159 Hannover | www.his.de
>
> Dennis Hörsch
> Unternehmensbereich Hochschul-IT
> Arbeitsbereich Entwicklung
> Telefon +49 (0)511 1220-403 | Fax +49 (0)511 1220-250
> E-Mail hoersch@his.de
>
> Registergericht: Amtsgericht Hannover, HRB 6489
> Geschäftsführer: Prof. Dr. Martin Leitner
> Vorsitzender des Aufsichtsrats: Ministerialdirigent Peter Greisler

Mime
View raw message