webtier@glassfish.java.net

Re: [webtier] Why does JSF 2.0 facelets eat spaces the way it does?

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Thu, 16 Jul 2009 16:44:02 -0700

This behavior has been bothering me as well - as Ed points out, the
possible solutions are more fraught than you might expect - but your
email (and embarrassing example) gave me the impetus to look at it
again, and I have an idea to try out, though it's one of those "so
simple I can't possibly be the first to think of it" sort of ideas, so
we'll have to see if it actually works.

I've opened up bug # 1208 to track the issue in Mojarra - I'd encourage
you to post any other implementation bugs you find to our bug database.

https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1208

Jim

On 7/16/09 4:32 PM, Ed Burns wrote:
>>>>>> On Thu, 16 Jul 2009 15:05:11 -0700 (PDT), webtier_at_javadesktop.org said:
>
> CH> I have a simple demo like this:
> CH> The current date and time in
> CH> <h:outputText value="#{timeZoneBean.city}"/>
> CH> is
> CH> <h:outputText value="#{timeZoneBean.time}"/>
>
> CH> Unfortunately, the output is
>
> CH> The current date and time inRome is9:30AM.
>
> CH> Note that there is no space after in and is.
>
> CH> Why is it that the h:outputText tag swallows ALL preceding space but
> CH> not the space that follows it? I know I can add&#160; to avoid this
> CH> (or just add spaces inside the value attributes). I just want to
> CH> know the rationale why Mojarra is so beastly. I mean, couldn't it
> CH> have replaced all that white space with one space? There seems
> CH> nothing in the standard to mandate the current behavior.
>
> Hello Cay,
>
> This issue has a colorful history in Facelets. Early manifestations
> dealt with the behavior of h:panelGrid and whitespace, starting with
> Issue 11 [1] where Jacob implemented the current behaviour. More work
> was done in issue 122 [2]. The issue was reopened and closed as
> WORKSFORME in June 2007 as issue 159 [3].
>
> The issue was seen again in 187, where Icefaces man Mark Collette had a
> nice analysis. [4].
>
> Cay's issue appears to be an instance of Issue 238 [5], in which Jacob said:
>
> "I'd recommend putting in an '&#160;' to produce 'Site Manager:&#160;'
>
> You can also disable whitespace trimming per the docs-- it's somewhat
> a double edged sword since you also would want to prune
> trailing/leading text in other cases."
>
> and marked the issue as WONTFIX in early August 2007.
>
> Someone else opened issue 252 [6] on this later that month, and again it was
> closed as WONTFIX, this time by Mike Youngstrom.
>
> The most recent, and still open, issue on this was filed by Dan Allen in
> September of 2008, issue 332 [7]. In the final discussions of JSF 2.0,
> the EG decided to defer solving it, which you can see on jsr-314-open
> [8]. Search [8] for "Better handling of whitespace in facelets".
>
> I'm going to ask Mojarra stalwart Jim Driscoll to take this case history
> and propose a solution. Jim?
>
> Ed
>
>
> [1] https://facelets.dev.java.net/issues/show_bug.cgi?id=11
>
> [2] https://facelets.dev.java.net/issues/show_bug.cgi?id=122
>
> [3] https://facelets.dev.java.net/issues/show_bug.cgi?id=159
>
> [4] https://facelets.dev.java.net/issues/show_bug.cgi?id=187
>
> [5] https://facelets.dev.java.net/issues/show_bug.cgi?id=238
>
> [6] https://facelets.dev.java.net/issues/show_bug.cgi?id=252
>
> [7] https://facelets.dev.java.net/issues/show_bug.cgi?id=332
>
> [8] http://archives.java.sun.com/cgi-bin/wa?A2=ind0904&L=JSR-314-OPEN&P=R9966&X=53E6BD3CA6806D5712&Y=ed.burns%40sun.com
>
>
> CH> Thanks,
>
> CH> Cay
> CH> [Message sent by forum member 'cayhorstmann' (cayhorstmann)]
>
> CH> http://forums.java.net/jive/thread.jspa?messageID=356124
>
> CH> ---------------------------------------------------------------------
> CH> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> CH> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>