• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Break lines in <textarea>

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ???
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic