[jsr-314-open] [jsf2next] might as well face it, Facelets is XML

Dan Allen dan.j.allen at gmail.com
Sun Dec 13 03:05:30 EST 2009


>
> Here's how the formal XML syntax would look (with our new URN namespaces
> ;))
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <f:view xmlns:f="jsf:core" xmlns:h="jsf:html" omitXmlDeclaration="true">
>    <h:doctype lang="xhtml" type="strict"/>
>    <h:html>
>       <h:head>
>       </h:head>
>       <h:body>
>         <h1>Hello World!</h1>
>       </h:body>
>    </h:html>
> </f:view>
>
> And we should be writing composite components like this:

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns:ui="jsf:facelets" xmlns:cc="jsf:cc">
   <cc:interface>
      <cc:attribute name="name" required="true"/>
   </cc:interface>
   <cc:implementation>
      Hello, #{cc.attr.name}
   </cc:implementation>
</ui:composition>

The point being, no need for all the HTML wrapper garbage.

I'd even like to get rid of the ui:composition there and perhaps have
something like "cc:component" or "cc:tag" as the wrapper.

We can also leverage the default namespace to cut out the unnecessary
namespace prefixes:

<?xml version="1.0" encoding="UTF-8"?>
<component xmlns="jsf:cc">
   <interface>
      <attribute name="name" required="true"/>
   </interface>
   <implementation>
      Hello, #{cc.attr.name}
   </implementation>
</component>

Notice that I'm not really changing all that much in JSF to get to this
point. It's really just a shift in thinking (and recommending).

-Dan

-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://www.google.com/profiles/dan.j.allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20091213/918f6821/attachment.html 


More information about the jsr-314-open-mirror mailing list