The idea is to render the text in HTML as the user would expect even
if he is no HTML expert. Therefore we address the special HTML
whitespace handling here:
* successive spaces are rendered as
* line breaks are rendered as <br/>
This is also the difference between write and writeText as I understand it.
Manfred
On 3/20/06, Jacob Hookom <[EMAIL PROTECTED]> wrote:
> I noticed in the ResponseWriter:
>
> public void writeText(char cbuf[], int off, int len)
> throws IOException
> {
> if(cbuf == null)
> throw new NullPointerException("cbuf name must not be null");
> if(cbuf.length < off + len)
> throw new IndexOutOfBoundsException((off + len) + " >
> " + cbuf.length);
> closeStartTagIfNecessary();
> if(isScriptOrStyle())
> {
> String strValue = new String(cbuf, off, len);
> _writer.write(UnicodeEncoder.encode(strValue, false, false));
> } else
> if(isTextarea())
> {
> String strValue = new String(cbuf, off, len);
> _writer.write(HTMLEncoder.encode(strValue, false, false));
> } else
> {
> String strValue = new String(cbuf, off, len);
> _writer.write(HTMLEncoder.encode(strValue, true, true));
> }
> }
>
> In the last case:
>
> HTMLEncoder.encode(strValue, true, true)
>
> Why would you want to tell the HTMLEncoder to write out a line break in
> this case and this case only?
>
> Adam and I are trying to get Facelets to go pure ResponseWriter for all
> encode events, but this little quirk causes pages to render with lots of
> breaks in MyFaces (this doesn't happen in the RI).
>
> --
> Jacob Hookom - Minneapolis
> ----------------------------
> JSF-EG, JSF-RI, EL, Facelets
>
>