Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

prob with bean:write

 
Amit KumarS
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have a prob with bean:write. the prob is
i am inserting value into database after taking value from one textarea. and then displaying that entered value into some other page using bean:write.
but the prob is when we enter the value and suppose we press enter key few time i.e. break down the text into different paragraphs. i am able to insert into database as it is.
but when i am trying to display those paragraphs using bean:write then it is omitting the line breaks. all the text is being displayed continuously instead of being displayed paragraph wise.
can some one help. Thanks a lot in advance.
Amit
 
David Hibbs
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is likely because
a) HTML treats more than one whitespace character (tab, space, CRLF, etc) as a single whitespace.
b) CRLF is not honored in HTML.
So you have a couple options.
1) When you get the data back from your database, you can replace all CRLF (aka \n or \r) characters with <br>
2) Put <pre> </pre> tags around the bean:write
3) Display all the text in a text box as it was entered (note that you can make this non-editable).
 
Amit KumarS
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi david,
thanx a lot man... it really helped me a lot.. i couldn't used the changing of CLRF to <br> and also display the data in text box and make it non-editable due to some project constrants.
but the <pre></pre> tag helped me a lot.
but now the prob is that the tag is not wrapping the text which i need to do. if the text is too long then i need it to be displayed after wrapping. but right now it is getting away from the browser's view and we have to scroll the text. this text is in a table so the row is also getting widened.
is there any solution to this???

thanx a lot man.
Amit
[ March 25, 2004: Message edited by: Amit KumarS ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic