What you usually do is to replace the renderer of the output-text
component - and replace all occurrences of \n with <br/> there.

Plus: you need to make sure that escape="false".

regards,

Martin

On 12/22/05, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> How can I replace the \n with a <br/> on the output? By javascript?
> Because when I write <h:outputText value="Hello<br/>World"/> It doesn't work.
>
> If I use the pre Tag, what can happen with the layout?
>
> Regards
> Andy
>
> -----Ursprüngliche Nachricht-----
> Von: Luiz Carlos Geron [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 21. Dezember 2005 14:13
> An: MyFaces Discussion
> Betreff: Re: AW: How to display Line breaks in Outputtext?
>
>
> > So the user has to write \n hardcoded into the textarea? Isn't there a way
> > to recognize a Carriage Return, when the user presses the CR Key?
> No. When you submit a form that contains a textarea, if you have typed:
>
> line
> other line
>
> Then if you make:
>
> String str1 = this.getInputTextarea1
> ().getValue().toString().replace("\n","<br>");
>
> You'll get "line<br>other line". Don't do this replace, since maybe you want
> to put the value in a textarea again.
>
> > And I don't unterstand what you mean with the <pre> tag.
> > Do you mean just: <pre><h:outputText value="Hello/nWorld"/></pre> and the
> > Text is shown as Hello
> > World
> >
> > ??
> Yes, you can also replace (on the output) the "\n" with <br>. I recommend this
> last option, since it don't use the <pre> html tag, wich can break you
> layout.
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to