[jsr-314-open] Facelets: XHTML vs. XML

Dan Allen dan.j.allen at GMAIL.COM
Tue May 12 16:38:28 EDT 2009


On Tue, May 12, 2009 at 4:36 PM, Dan Allen <dan.j.allen at gmail.com> wrote:

> On Tue, May 12, 2009 at 3:47 PM, Martin Marinschek <mmarinschek at apache.org
> > wrote:
>
>> Hi Andy,
>>
>> one more issue which _always_ comes up with people working with
>> facelets and of course also stems from the same root-cause is the
>> comment-problem - how can you correctly have comments for facelets and
>> comments for the output?
>>
>> The way we currently do this is either set SKIP_COMMENTS to true -
>> which effectively disallows HTML comments - or use ui:remove to make
>> parts of the page Facelets-comments. However, the second approach
>> doesn't allow invalid XML-snippets inside the ui:remove section - and
>> this can be a very annoying thing then.
>>
>> Maybe it would be better to set SKIP_COMMENTS to true by default - and
>> then have an <h:outputComment> for emitting HTML comments (I believe
>> the problem of invalid XML in HTML-comments is not as big as in
>> comments which are meant to be there for facelets).
>
>
> Martin, you have struck a very strong chord with me. I was just dealing
> with this exact issue all week. To create a real Facelets comment, putting
> SKIP_COMMENTS aside, I have to do:
>
> <ui:remove><!--
> I'm thinking of using <rich:dataTable> but I haven't added the RichFaces
> libraries yet.
> --></ui:remove>
>
> To me, that seems like complete overkill. I would much prefer if Facelets
> just stayed out of comments and like Martin said, we consider producing a
> comment with a tag (since producing a comment is extremely rare anyway). I
> would even support the idea of using comment markers inside the tag so that
> it is still possible to use invalid XML.
>
> <h:outputComment><!--
> This is a comment with invalid <<XML>>
> --></h:outputComment>
>
> Of course, the comment markers would be optional...they just allow the
> template to be well-formed XML if you happen to use invalid markup in the
> comment.
>

I should also mention that Facelets interpolates EL in comments (when they
are not skipped) which almost always surprises developers. I would guess
that with <h:outputComment> the EL would be interpolated since the intent is
to render the content. That would be consistent. You almost never want
Faclets to interpolate EL in a developer comment (not rendered)

-Dan

-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan

NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20090512/d1f91038/attachment.html 


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