webtier@glassfish.java.net

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

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Thu, 16 Jul 2009 16:32:55 -0700

>>>>> 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

-- 
| ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
| homepage:         | http://ridingthecrest.com/