dev@javaserverfaces.java.net

Re: h:inputTextArea swallows one leading newline

From: Daniel Lichtenberger <daniel.lichtenberger_at_gmx.net>
Date: Thu, 18 Apr 2013 11:37:38 +0200

Hi Manfred,

On 04/11/2013 05:53 PM, Manfred Riem wrote:
> I would suggest if you want to make sure that you don't lose content to
> add a \n at the beginning and the end on the server side of your
> application.

I also tried this, but it gets ugly very quickly (now you need a special
getter for providing the value to the input).

> Note you probably want to review your pages if you have more than one
> page using the textarea tag and make sure they are all used in the same
> way.

I believe the Rails guys fixed this by always writing a newline after
the opening <textarea> tag, which (I think) would also work in JSF -
note that the issue is specific to the textarea tag, as it _doesn't_
trim leading whitespace (except the newline immediately following the
opening tag).

Daniel


>
> Regards,
> Manfred
>
> On 3/25/2013 2:14 PM, daniel.lichtenberger_at_gmx.net wrote:
>> Hi Manfred,
>>
>> Thanks for the quick reply.
>>
>>> If you think the specification and thus the implementation of
>> h:inputTextarea needs to
>>> deal with this you probably are looking a specification issue, which
>> are tracked at
>>> the JAVASERVERFACES_SPEC_PUBLIC jira issue tracker.
>> I'm not sure how deep the issue goes - maybe the browser behaviour
>> depends on the DOCTYPE? Were there any changes in the XML writers? Did
>> each JSF application since 1.0 have this (admittedly obscure) issue
>> with textareas? Did older, less standards-conformant browsers behave
>> differently? I'd like to hear if other people had/have this problem,
>> too.
>>
>> Daniel
>

-- 
DI Daniel Lichtenberger
UCS - unique computing solutions gmbh
Salztorgasse 1/2A
A-1010 Wien
t: +43 1 7182121 70
f: +43 1 7182121 90
e: daniel.lichtenberger_at_ucs.at
w: http://www.ucs.at