You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Charbel Abdul-Massih <ca...@soundbite.com> on 2007/03/21 14:54:55 UTC

SIMPLE question - How can I get   to work

I am using JSF with facelets...

I just need to output a space character "&nbsp;" in my page...

 

For some reason, it is not working for me...

 

I tried <h:outputText value="&nbsp;" escape="false"/>

 

That's not working...

 

Can you please help!!!!!!


Re: SIMPLE question - How can I get   to work

Posted by Jonathan Harley <jo...@parkplatz.net>.
David Delbecq wrote:
> En l'instant précis du 23/03/07 11:54, Jonathan Harley s'exprimait en
> ces termes:
>>> moreover the xml parser itself has no notion of the &nbsp; entity and
>>> will fail to parse it=
>>
>> Not true, as &nbsp; is defined in the XHTML DTD. As long as the
>> doctype references this, the XML parser understands it.
...
>> The XHTML standard mandates that hex references must use lower
>> case, so you should really put &#xa0; (or use non-hex i.e. &#160;),
>> but most browsers would understand upper case I guess.
>>
> Facelets does not take an xhtml input but an xml template made of
> various namespaces.

OK, it's true that facelets reads XML files not HTML, but if you
want HTML output, it seems perverse not to use XHTML after you've
gone to the trouble of making your document valid XML!

> We don't care about browser as our reader is an xml parser that will
> feed facelets view handler. Even if you write &#xa0; in your facelets
> template, you probably won't get the same in facelets output but, as i
> said, an unicode character that has same behaviour.

I must say, if facelets turns valid XHTML input into something that
is invalid XHTML output, it's broken IMO.

> Anyway, i think the original poster has his answers now :D

More answers than he wanted, probably! *g*

J.
-- 
.....................................................................
           Dr Jonathan Harley   .
                                .   Email: jon@parkplatz.net
            Zac Parkplatz Ltd   .   Office Telephone: 024 7633 1375
            www.parkplatz.net   .   Mobile: 079 4116 0423

Re: SIMPLE question - How can I get   to work

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 23/03/07 11:54, Jonathan Harley s'exprimait en
ces termes:
>> moreover the xml parser itself has no notion of the &nbsp; entity and
>> will fail to parse it
> the &...; entities are read by xml parser and never seen by facelets,
>
> Not true, as &nbsp; is defined in the XHTML DTD. As long as the
> doctype references this, the XML parser understands it.
There are lots of ways to defines &nbsp; as an entity for the parser,
but unless you explicitly define it using an included dtd or other
mecanism, it does not exist. And what ever you defined entities to, they
are used only by parser, facelets does not see the entities, only the
character(s) or node(s) represented by that entity.
>
>> However, non breakable space is only a special character, that is also
>> reachable via it's unicode value, so you can simply write
>>
>> &#xA0;
>>
> The XHTML standard mandates that hex references must use lower
> case, so you should really put &#xa0; (or use non-hex i.e. &#160;),
> but most browsers would understand upper case I guess.
>
Facelets does not take an xhtml input but an xml template made of
various namespaces. Specs of xml  1.0 states:
[66]       CharRef       ::=       '&#' [0-9]+ ';'     |      '&#x'
[0-9a-fA-F]+ ';'


We don't care about browser as our reader is an xml parser that will
feed facelets view handler. Even if you write &#xa0; in your facelets
template, you probably won't get the same in facelets output but, as i
said, an unicode character that has same behaviour.

Anyway, i think the original poster has his answers now :D

Re: SIMPLE question - How can I get   to work

Posted by Jonathan Harley <jo...@parkplatz.net>.
David Delbecq wrote:
> Hi, if you want "literally" the four character & n b s p ; in the
> output, you must do this:
> 
> <h:outputText value=”&amp;nbsp;” escape=”false”/>

Or write a tag (easy in facelets) so that you can do <n:bsp/>
or similar.

> the &...; entities are read by xml parser and never seen by facelets,
> moreover the xml parser itself has no notion of the &nbsp; entity and
> will fail to parse it

Not true, as &nbsp; is defined in the XHTML DTD. As long as the
doctype references this, the XML parser understands it.

The problem seems to be that the &nbsp; entity is being treated as
whitespace, and therefore eliminated from the XML tree, but numeric
entities are treated as text, and get built into the component tree
by facelets.

> However, non breakable space is only a special character, that is also
> reachable via it's unicode value, so you can simply write
> 
> &#xA0;
> 
> instead of all the awfull outputText thingy. It will not issue a &nbsp;
> in the output html but will issue a non visual character having same
> behaviour.

The XHTML standard mandates that hex references must use lower
case, so you should really put &#xa0; (or use non-hex i.e. &#160;),
but most browsers would understand upper case I guess.

> En l'instant précis du 21/03/07 14:54, Charbel Abdul-Massih s'exprimait
> en ces termes:
>> I am using JSF with facelets…
>>
>> I just need to output a space character “&nbsp;” in my page…


-- 
.....................................................................
           Dr Jonathan Harley   .
                                .   Email: jon@parkplatz.net
            Zac Parkplatz Ltd   .   Office Telephone: 024 7633 1375
            www.parkplatz.net   .   Mobile: 079 4116 0423

RE: SIMPLE question - How can I get   to work

Posted by Charbel Abdul-Massih <ca...@soundbite.com>.
What ended up working for me is using "&#160;"...

Also, <h:outputText value="&amp;nbsp;" escape="false"/> worked as
well...

Thanks guys...


Re: SIMPLE question - How can I get   to work

Posted by David Delbecq <de...@oma.be>.
Hi, if you want "literally" the four character & n b s p ; in the
output, you must do this:

<h:outputText value=”&amp;nbsp;” escape=”false”/>

the &...; entities are read by xml parser and never seen by facelets,
moreover the xml parser itself has no notion of the &nbsp; entity and
will fail to parse it

However, non breakable space is only a special character, that is also
reachable via it's unicode value, so you can simply write

&#xA0;

instead of all the awfull outputText thingy. It will not issue a &nbsp;
in the output html but will issue a non visual character having same
behaviour.
En l'instant précis du 21/03/07 14:54, Charbel Abdul-Massih s'exprimait
en ces termes:
>
> I am using JSF with facelets…
>
> I just need to output a space character “&nbsp;” in my page…
>
>  
>
> For some reason, it is not working for me…
>
>  
>
> I tried <h:outputText value=”&nbsp;” escape=”false”/>
>
>  
>
> That’s not working…
>
>  
>
> Can you please help!!!!!!
>


Re: SIMPLE question - How can I get   to work

Posted by Christopher Cudennec <Sm...@gmx.net>.
Even simpler: Use &#160;

shaikyesdani.basha@wipro.com schrieb:
>
> Use <h:outputText value=” ” />
>
> ------------------------------------------------------------------------
>
> *From:* Charbel Abdul-Massih [mailto:cabdulmassih@soundbite.com]
> *Sent:* Wednesday, March 21, 2007 7:25 PM
> *To:* MyFaces Discussion
> *Subject:* SIMPLE question - How can I get &nbsp; to work
>
> I am using JSF with facelets…
>
> I just need to output a space character “&nbsp;” in my page…
>
> For some reason, it is not working for me…
>
> I tried <h:outputText value=”&nbsp;” escape=”false”/>
>
> That’s not working…
>
> Can you please help!!!!!!
>
>
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of the 
> addressee(s) and may contain proprietary, confidential or privileged 
> information. If you are not the intended recipient, you should not 
> disseminate, distribute or copy this e-mail. Please notify the sender 
> immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient 
> should check this email and any attachments for the presence of 
> viruses. The company accepts no liability for any damage caused by any 
> virus transmitted by this email.
>
> www.wipro.com
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.15/728 - Release Date: 20.03.2007 08:07
>   


RE: SIMPLE question - How can I get   to work

Posted by sh...@wipro.com.
Use <h:outputText value="  " />

 

 

________________________________

From: Charbel Abdul-Massih [mailto:cabdulmassih@soundbite.com] 
Sent: Wednesday, March 21, 2007 7:25 PM
To: MyFaces Discussion
Subject: SIMPLE question - How can I get &nbsp; to work

 

I am using JSF with facelets...

I just need to output a space character "&nbsp;" in my page...

 

For some reason, it is not working for me...

 

I tried <h:outputText value="&nbsp;" escape="false"/>

 

That's not working...

 

Can you please help!!!!!!




The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com

Re: SIMPLE question - How can I get   to work

Posted by Mike Kienenberger <mk...@gmail.com>.
http://wiki.java.net/bin/view/Projects/FaceletsFAQ#How_do_I_insert_a_non_breaking_s


On 3/22/07, Josué Alcalde González <jo...@gmail.com> wrote:
> El mié, 21-03-2007 a las 08:01 -0600, SOSELLA@austin.rr.com escribió:
> > I think that with facelets you don't need to use h:outputText... just
> > put &nbsp; by itself.
>
> No, it don't work because the first thing that facelets do is parse the
> xml, and &nbsp is not a correct entity in xml/xhtml.
>
> You must use &#160; or &#xA0 (the same but using hexadecimal notation).
>
>

Re: SIMPLE question - How can I get   to work

Posted by Josué Alcalde González <jo...@gmail.com>.
El mié, 21-03-2007 a las 08:01 -0600, SOSELLA@austin.rr.com escribió:
> I think that with facelets you don't need to use h:outputText... just
> put &nbsp; by itself.

No, it don't work because the first thing that facelets do is parse the
xml, and &nbsp is not a correct entity in xml/xhtml.

You must use &#160; or &#xA0 (the same but using hexadecimal notation).


Re: SIMPLE question - How can I get   to work

Posted by SO...@austin.rr.com.
I think that with facelets you don't need to use h:outputText... just
put &nbsp; by itself.


----- Original Message -----
From: Charbel Abdul-Massih <ca...@soundbite.com>
Date: Wednesday, March 21, 2007 7:56 am
Subject: SIMPLE question - How can I get &nbsp; to work
To: MyFaces Discussion <us...@myfaces.apache.org>

> I am using JSF with facelets...
> 
> I just need to output a space character " " in my page...
> 
> 
> 
> For some reason, it is not working for me...
> 
> 
> 
> I tried <h:outputText value=" " escape="false"/>
> 
> 
> 
> That's not working...
> 
> 
> 
> Can you please help!!!!!!
> 
> 

Re: SIMPLE question - How can I get   to work

Posted by Mads Henderson <ma...@gmail.com>.
I use stuff like

    <h:outputText escape="false" value="&nbsp;&nbsp;&nbsp;"/> or
      <h:outputText escape="false" value="<p/>"/>

all the time How is this not working for you, do you get an error or does it
simply not get rendered?

Another way to type html inside you page is to use f:verbatim like:

    <f:verbatim>
      My HTML goes here
    </f:verbatim>

Hope that helps
madsph

On 3/21/07, Charbel Abdul-Massih <ca...@soundbite.com> wrote:
>
>  I am using JSF with facelets…
>
> I just need to output a space character "&nbsp;" in my page…
>
>
>
> For some reason, it is not working for me…
>
>
>
> I tried <h:outputText value="&nbsp;" escape="false"/>
>
>
>
> That's not working…
>
>
>
> Can you please help!!!!!!
>