Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Break lines in <textarea>  RSS feed

 
Ahmed Battah
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a tag like this:
<h:inputTextArea cols="60" rows="10" styleClass="text_area">

when the user enter a text like this:
a
b
c

The output appear: abc

it must be as input.
can anybody help me ???
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to output it preformatted. You can either output it in a h:inputTextarea or in a component/HTMLelement to your choice where on you apply the CSS white-space:pre property.

If you don't want to output it preformatted, but as truetype or whatever text, then you need to convert newlines to HTML <br> elements. You know, a linebreak in plain HTML is to be represented with the <br> element. You can use String#replace() or JSTL's fn:replace for this.

Edit: sorry for countless edits; the darn forum engine apparently got a new bug in parsing HTML entities.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!