• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display line break in browser using h:inputTextarea?

 
peter tong
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display something like
ab
def

I try the following code


but the output is
ac<br/>de<br>/

so how to let the browser output
ab
def
using <h:inputTextarea>??
 
a phil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

interrupt the rendering of the value of the inputtextArea - you can do this using a javascript function by getting hold of the id ( handler of the tag on the form), and then manipulate the value attribute of the inputTextArea value. You can also achieve the new - line feature as desired using a javascript array. First get the value of the inputTextArea and then create a js array of strings that you want them to render... and then display this array structure as the value... you can do this by updating the value using str1, and javascript's new line and repeating this until last string is updating on the value attribute and then finally render the value. Please remember you need to do all this before the form is rendered... (i think you need to use a hidden variable on the form that holds the value tht the inputtextarea must be updated with.. you can update hidden var from the backing bean... )..hope this helped.. gud luck !
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"java seeker", please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic