When we write something in several paragraphs in textarea of browser then it shows as it is in teaxtarea. But when we want to show the text in read only mode then the paragraphs loose their identity. I mean you can not separate the paragraphs from each other. So we need to replace the newlines of the text by
.
I have written a simple function named ‘keepWhiteSpace’ to do this conversion and I used it in many of Therap's forms to display the saved text as it is. Usage is very simple.
For example, if you want to show your text in a cell then write as follows:
${therap.keepWhiteSpace(myText)}
The implementation is very simple.
<#function keepWhiteSpace value>
<#return value?replace("\r\n","<br>")?replace("\n\r","<br>")?replace("\r","<br>")?replace("\n","<br>")>
</#function>
Ftl(Free Marker Tag Library) users can use it without rewriting any new one. JSP users need to write a tag using the logic.
Note that I haven’t replaced spaces by
2 comments:
thanx a lot:)
Happy Mothers Day 2015 Ecards
Thankx Mother's Day 2017 India
Mothers Day Date 2017
Mothers Day Quotes
Happy Mother’s Day
MOTHER’S DAY
Mother’s Day Messages
Mothers Day SMS in Hindi
Happy Mothers Day Quotes
Happy Mothers Day Images,Sms,Quotes
Happy Mother"s Day
Post a Comment