webtier@glassfish.java.net

Re: [webtier] ui:composition with template behaving strangely

From: Joel Weight <digitaljoel_at_gmail.com>
Date: Wed, 5 May 2010 14:26:15 -0600

Anyone have any thoughts on this? We are finding that we are having to rip
out basically all of our ui:compositions and try to convert them to
composite implementations. In many cases, this is a good thing anyway, but
is it expected that ui:composition just doesn't work (as described above)?
 It's like el variables are bleeding all over the place and not being
updated or something. Could it be a problem with the EL?

Here's our jsf related dependencies if it helps. We are running in GF3.

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.0.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>el-impl</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>el-api</artifactId>
            <version>2.2</version>
        </dependency>

Thanks,
Joel


On Wed, Apr 28, 2010 at 11:22 AM, <webtier_at_javadesktop.org> wrote:

> I am seeing some strange behavior when trying to convert a JSF 1.2 app in
> GF2 to JSF 2 in GF3. It worked fine previously. Here is the problem.
>
> I have a simple page as follows:
>
> <ui:composition template="/WEB-INF/layout/layout.xhtml">
> <ui:define name="header"/>
> <ui:define name="content">
> This is contents. Test1 starts.
> <a:test1
> testAttribute="attribute1"/>
> <a:test2
> testAttribute="attribute2"/>
> Test1 ends.
> </ui:define>
> <ui:define name="footer">
> </ui:define>
> </ui:composition>
>
> Here is test1.xhtml
>
> <ui:composition template="/WEB-INF/facelets/tags/section.xhtml">
> <ui:define name="section-content">
> This is test1
> #{testAttribute}
> </ui:define>
> </ui:composition>
>
> And here is test2.xhtml
>
> <ui:composition template="/WEB-INF/facelets/tags/section.xhtml">
> <ui:define name="section-content">
> This is test2
> #{testAttribute}
> </ui:define>
> </ui:composition>
>
>
> The output you would expect would be as follows
>
> This is contents. Test1 starts.
> This is test1 attribute1
> This is test2 attribute2
> Test1 ends
>
>
> The output we are actually getting is as follows:
>
> This is contents. Test1 starts.
> This is test1 attribute1
> This is test1 attribute2
> Test1 ends
>
>
> Notice that the static content in test2.xhtml is using the content from
> test1.xhtml, but the new attribute value is used.
>
> If we remove the template from the composition, and instead use the
> ui:decorate tag, then things display as expected.
>
> Did the expected behavior of ui:composition change in JSF 2, or is it
> broken?
>
> Thanks,
> Joel
> [Message sent by forum member 'jweight']
>
> http://forums.java.net/jive/thread.jspa?messageID=399435
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>