jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] Re: Re: [ADMIN] JSF 2.2 PFD RC2

From: Michael Müller <michael.mueller_at_mueller-bruehl.de>
Date: Sun, 03 Mar 2013 09:00:10 +0100

Hi Ed,

Once again...

We have to consider compatibility for existing apps. If someone uses
"p:" as alias for PrimeFaces, then she may define "pa:" for Pass Through
Attributes. Same applys for "jsf:". On the other hand, I understand ease
of use. Someone may use "jsf:" without declaring a namespace.

Suggestion:
If an attribute of an element is prefixed with a namespace alias
pointing to the namespace "http://java.sun.com/jsf", then add the
element to the component tree. If any attribute is prefixed with "jsf:"
and this alias is not defined, then treat it as defined for namespace
"http://java.sun.com/jsf".

Examples:
Valid PT Element
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:jsf="http://java.sun.com/jsf" >
     <head jsf:id="head">[...]

Valid PT Element
<html xmlns="http://www.w3.org/1999/xhtml" >
     <head jsf:id="head">[...]

Valid PT Element
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:XXX="http://java.sun.com/jsf" >
     <head XXX:id="head">[...]

And this one ignored by JSF (pointing to different namespace)
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:jsf="http://myCompany.com/myNamespace" >
     <head jsf:id="head">[...]

Becoming a kind of paranoid, I replaced
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:ui="http://java.sun.com/jsf/facelets">

by
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:x="http://java.sun.com/jsf/html" <!-- use different alias-->
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:ui="http://java.sun.com/jsf/facelets">

This works fine. Same should apply to "http://java.sun.com/jsf", as
suggested above.

Herzliche Grüße - Best Regards,
Michael Müller

Am 02.03.2013 22:16, schrieb Michael Müller:
> Hi Ed,
>
> I just compared to the doc:
> "If the namespace of the tag is any namespace other than the empty
> string or |http://www.w3.org/1999/xhtml|, throw a |FaceletException|
> <mailbox:///D:/thunderbird/Mail/Local%20Folders/JSF?number=1133067&header=quotebody&part=1.2.2&filename=FaceletException.html>."
>
> Of which tag? If somebody looks ahead to the table, she might guess
> "jsf". To become clear, the tag "jsf" should be mentioned.
>
> If I understood right, your intention is:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:jsf="http://java.sun.com/jsf" >
> <head jsf:id="head">[...]
>
> equivalent to
>
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head jsf:id="head">[...]
>
> Error:
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:jsf="http://myCompany.com/myNamespace" >
> <head jsf:id="head">[...]
>
> And this one ignored by JSF (unknown tag):
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:XXX="http://java.sun.com/jsf" >
> <head XXX:id="head">[...]
>
> Right?
>
> I still belive, this is not a good way.
>
> Best Regards,
> Michael Müller
>
> Am 02.03.2013 21:54, schrieb Michael Müller:
>>
>> Herzliche Grüße - Best Regards,
>> Michael Müller
>>
>> Am 28.02.2013 22:15, schrieb Edward Burns:
>>>>>>>> On Sun, 24 Feb 2013 08:41:31 +0100, Michael Müller
>>>>>>>> <michael.mueller_at_mueller-bruehl.de> said:
>>> MM> Hi Ed,
>>> MM> From Interfac TagDecorator:
>>> MM> "A selector attribute name prefixed with *jsf:* means in the
>>> MM> |http://java.sun.com/jsf| namespace."
>>>
>>> Thanks. I've fixed it
>>>
>>> MM> Or does it mean "treat prefix jsf always as
>>> ofhttp://java.sun.com/jsf even though it is not declared"?
>>>
>>> yes, the latter.
>>>
>>> Ed
>>>
>> Hm, just parsing for JSF and then calling TagDecorator is quite
>> simple, with the smell of quick'n'dirty.
>>
>> Thus
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:jsf="http://java.sun.com/jsf" >
>> <head jsf:id="head">[...]
>>
>> is equivalent to
>>
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head jsf:id="head">[...]
>>
>> What happens, if someone would declare
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:jsf="http://myCompany.com/myNameSpace" >
>> <head jsf:id="head">[...]
>>
>> The prefix jsf then still is used for JSF even though pointing to a
>> different namespace.
>>
>> IMHO it is better to use a fixed namespace with mutable prefix
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:jsf="http://java.sun.com/jsf" >
>> <head jsf:id="head">[...]
>>
>> equivalent to
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:XXX="http://java.sun.com/jsf" >
>> <head XXX:id="head">[...]
>>
>> This approach is a bit more sophistiocated to implement, but it would
>> be a cleaner, especially standardized usage.
>>
>>
>>
>