You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Johannes Murth <jo...@gmail.com> on 2014/02/13 13:10:34 UTC

Composite components in myfaces 2.2.

Hi! I just upgraded from 2.1 to 2.2 and have rendering problem because xml
doctype and html tag are rendered right before composite component. These
break the layout and should just be swallowed.

Thanks for any advice!

Re: Composite components in myfaces 2.2.

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I think the problem is mix ui:composition with cc:interface or
cc:implementation. The compiler check these tags and do some special
steps. Just use other different tag like this.

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html" .... >

regards,

Leonardo Uribe

2014-02-24 15:01 GMT-05:00 Michael Kurz <mi...@gmx.at>:
> Maybe you are missing a faces-config.xml in the jar inside META-INF. JSF
> won't scan the jar otherwise. See my post at JSFlive [1] for details.
>
> Best regards
> Michi
>
> [1]: http://jsflive.wordpress.com/2011/03/24/custom-component-library/
>
>
> Am 24.02.2014 13:26, schrieb Johannes Murth:
>
>> The output of DOCTYPE was related to another issue:
>>
>> The XHTML that is embedded with ui:include had this as root element.
>> ui:composition as root element solved the problem.
>> - Side question: is this an official change from 2.1 to 2.2?
>>
>> But there is still the issue that the composite component from the JAR is
>> not found:
>>
>> The using page looks like this:
>>
>> < ....
>>        xmlns:xma="http://openxma.codehaus.org/xmajsf"
>>    >
>> ...
>>      <xma:navbar .. brand="Test" />
>>      ..
>> </...>
>>
>> The component is  in somelib.jar/META-INF/resources/xmajsf/navbar.xhtml
>> and
>> looks like this
>>
>> Beside there is a xmajsf.taglib.xml in the root of the same JAR:
>> <ui:composition xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:cc="http://java.sun.com/jsf/composite"
>>      xmlns:ui="http://java.sun.com/jsf/facelets">
>> <cc:interface componentType="Navbar">
>> <cc:attribute name="brand" required="true"/>
>> </cc:interface>
>> <cc:implementation>
>> ...
>> </cc:implementation>
>> </ui:composition>
>>
>> Beside there is this content in META-INF\xmajsf.taglib.xml inside the same
>> JAR:
>>
>> <facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="
>> http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
>>   <namespace>http://openxma.codehaus.org/xmajsf</namespace>
>>   <composite-library-name>xmajsf</composite-library-name>
>> </facelet-taglib>
>>
>> What am I doing wrong?
>>
>>
>>
>> 2014-02-14 17:52 GMT+01:00 Michael Kurz <mi...@gmx.at>:
>>
>>> Hi,
>>>
>>> would be interesting how your composite component looks like (the basic
>>> structure) and how it is embedded in the page.
>>>
>>> Best regards
>>> Michi
>>>
>>> Am 13.02.2014 13:10, schrieb Johannes Murth:
>>>
>>>   Hi! I just upgraded from 2.1 to 2.2 and have rendering problem because
>>> xml
>>>>
>>>> doctype and html tag are rendered right before composite component.
>>>> These
>>>> break the layout and should just be swallowed.
>>>>
>>>> Thanks for any advice!
>>>>
>>>>
>>
>

Re: Composite components in myfaces 2.2.

Posted by Johannes Murth <jo...@gmail.com>.
No, that is in place.
Putting a simpler test component inside the same JAR showed that the
loading is done correctely. So the problem is not the refernciation of the
CC, it is the implementation.

The xhtml of the component is here:
http://svn.codehaus.org/openxma/org.openxma.dsl/trunk/org.openxma.dsl.platform.jsf/src/main/resources/META-INF/resources/xmajsf/navbar.xhtml
The Java is here:
http://svn.codehaus.org/openxma/org.openxma.dsl/trunk/org.openxma.dsl.platform.jsf/src/main/java/org/openxma/dsl/platform/jsf/components/Navbar.java

Replacing the root element of the cc in the xhtml is not sufficient.

br, johannes



2014-02-24 21:01 GMT+01:00 Michael Kurz <mi...@gmx.at>:

> Maybe you are missing a faces-config.xml in the jar inside META-INF. JSF
> won't scan the jar otherwise. See my post at JSFlive [1] for details.
>
> Best regards
> Michi
>
> [1]: http://jsflive.wordpress.com/2011/03/24/custom-component-library/
>
>
> Am 24.02.2014 13:26, schrieb Johannes Murth:
>
>  The output of DOCTYPE was related to another issue:
>>
>> The XHTML that is embedded with ui:include had this as root element.
>> ui:composition as root element solved the problem.
>> - Side question: is this an official change from 2.1 to 2.2?
>>
>> But there is still the issue that the composite component from the JAR is
>> not found:
>>
>> The using page looks like this:
>>
>> < ....
>>        xmlns:xma="http://openxma.codehaus.org/xmajsf"
>>    >
>> ...
>>      <xma:navbar .. brand="Test" />
>>      ..
>> </...>
>>
>> The component is  in somelib.jar/META-INF/resources/xmajsf/navbar.xhtml
>> and
>> looks like this
>>
>> Beside there is a xmajsf.taglib.xml in the root of the same JAR:
>> <ui:composition xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:cc="http://java.sun.com/jsf/composite"
>>      xmlns:ui="http://java.sun.com/jsf/facelets">
>> <cc:interface componentType="Navbar">
>> <cc:attribute name="brand" required="true"/>
>> </cc:interface>
>> <cc:implementation>
>> ...
>> </cc:implementation>
>> </ui:composition>
>>
>> Beside there is this content in META-INF\xmajsf.taglib.xml inside the same
>> JAR:
>>
>> <facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="
>> http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
>>   <namespace>http://openxma.codehaus.org/xmajsf</namespace>
>>   <composite-library-name>xmajsf</composite-library-name>
>> </facelet-taglib>
>>
>> What am I doing wrong?
>>
>>
>>
>> 2014-02-14 17:52 GMT+01:00 Michael Kurz <mi...@gmx.at>:
>>
>>  Hi,
>>>
>>> would be interesting how your composite component looks like (the basic
>>> structure) and how it is embedded in the page.
>>>
>>> Best regards
>>> Michi
>>>
>>> Am 13.02.2014 13:10, schrieb Johannes Murth:
>>>
>>>   Hi! I just upgraded from 2.1 to 2.2 and have rendering problem because
>>> xml
>>>
>>>> doctype and html tag are rendered right before composite component.
>>>> These
>>>> break the layout and should just be swallowed.
>>>>
>>>> Thanks for any advice!
>>>>
>>>>
>>>>
>>

Re: Composite components in myfaces 2.2.

Posted by Michael Kurz <mi...@gmx.at>.
Maybe you are missing a faces-config.xml in the jar inside META-INF. JSF 
won't scan the jar otherwise. See my post at JSFlive [1] for details.

Best regards
Michi

[1]: http://jsflive.wordpress.com/2011/03/24/custom-component-library/


Am 24.02.2014 13:26, schrieb Johannes Murth:
> The output of DOCTYPE was related to another issue:
>
> The XHTML that is embedded with ui:include had this as root element.
> ui:composition as root element solved the problem.
> - Side question: is this an official change from 2.1 to 2.2?
>
> But there is still the issue that the composite component from the JAR is
> not found:
>
> The using page looks like this:
>
> < ....
>        xmlns:xma="http://openxma.codehaus.org/xmajsf"
>    >
> ...
>      <xma:navbar .. brand="Test" />
>      ..
> </...>
>
> The component is  in somelib.jar/META-INF/resources/xmajsf/navbar.xhtml and
> looks like this
>
> Beside there is a xmajsf.taglib.xml in the root of the same JAR:
> <ui:composition xmlns="http://www.w3.org/1999/xhtml"
> xmlns:cc="http://java.sun.com/jsf/composite"
>      xmlns:ui="http://java.sun.com/jsf/facelets">
> <cc:interface componentType="Navbar">
> <cc:attribute name="brand" required="true"/>
> </cc:interface>
> <cc:implementation>
> ...
> </cc:implementation>
> </ui:composition>
>
> Beside there is this content in META-INF\xmajsf.taglib.xml inside the same
> JAR:
>
> <facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
>   <namespace>http://openxma.codehaus.org/xmajsf</namespace>
>   <composite-library-name>xmajsf</composite-library-name>
> </facelet-taglib>
>
> What am I doing wrong?
>
>
>
> 2014-02-14 17:52 GMT+01:00 Michael Kurz <mi...@gmx.at>:
>
>> Hi,
>>
>> would be interesting how your composite component looks like (the basic
>> structure) and how it is embedded in the page.
>>
>> Best regards
>> Michi
>>
>> Am 13.02.2014 13:10, schrieb Johannes Murth:
>>
>>   Hi! I just upgraded from 2.1 to 2.2 and have rendering problem because xml
>>> doctype and html tag are rendered right before composite component. These
>>> break the layout and should just be swallowed.
>>>
>>> Thanks for any advice!
>>>
>>>
>

Re: Composite components in myfaces 2.2.

Posted by Johannes Murth <jo...@gmail.com>.
The output of DOCTYPE was related to another issue:

The XHTML that is embedded with ui:include had this as root element.
ui:composition as root element solved the problem.
- Side question: is this an official change from 2.1 to 2.2?

But there is still the issue that the composite component from the JAR is
not found:

The using page looks like this:

< ....
      xmlns:xma="http://openxma.codehaus.org/xmajsf"
  >
...
    <xma:navbar .. brand="Test" />
    ..
</...>

The component is  in somelib.jar/META-INF/resources/xmajsf/navbar.xhtml and
looks like this

Beside there is a xmajsf.taglib.xml in the root of the same JAR:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://java.sun.com/jsf/composite"
    xmlns:ui="http://java.sun.com/jsf/facelets">
<cc:interface componentType="Navbar">
<cc:attribute name="brand" required="true"/>
</cc:interface>
<cc:implementation>
...
</cc:implementation>
</ui:composition>

Beside there is this content in META-INF\xmajsf.taglib.xml inside the same
JAR:

<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
 <namespace>http://openxma.codehaus.org/xmajsf</namespace>
 <composite-library-name>xmajsf</composite-library-name>
</facelet-taglib>

What am I doing wrong?



2014-02-14 17:52 GMT+01:00 Michael Kurz <mi...@gmx.at>:

> Hi,
>
> would be interesting how your composite component looks like (the basic
> structure) and how it is embedded in the page.
>
> Best regards
> Michi
>
> Am 13.02.2014 13:10, schrieb Johannes Murth:
>
>  Hi! I just upgraded from 2.1 to 2.2 and have rendering problem because xml
>> doctype and html tag are rendered right before composite component. These
>> break the layout and should just be swallowed.
>>
>> Thanks for any advice!
>>
>>

Re: Composite components in myfaces 2.2.

Posted by Michael Kurz <mi...@gmx.at>.
Hi,

would be interesting how your composite component looks like (the basic 
structure) and how it is embedded in the page.

Best regards
Michi

Am 13.02.2014 13:10, schrieb Johannes Murth:
> Hi! I just upgraded from 2.1 to 2.2 and have rendering problem because xml
> doctype and html tag are rendered right before composite component. These
> break the layout and should just be swallowed.
>
> Thanks for any advice!
>