• Post Reply Bookmark Topic Watch Topic
  • New Topic

outputText i want to split a string whith <br/> or /n dosent work ?  RSS feed

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsf page with this outputText:


<hutputText value="#{FundDetailBB.benchMarkName}" id="_idProfileBenchMarkValue"/>


The string is : "test1/ntest2/ntest3"

But the result on my page is:

test1/ntest2/ntest3

All i want is that the text on my page is test1
test2
test3

in 3 lines....


I have also tried with


Any good ideas ?

Frank
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
well, probably you were meaning '\n' and NOT '/n'.
Moreover, do you want to get or
test1
test2
test3
?

Obviously, as an html page, the output may be different.
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want on 3 lines

test1
test2
test3

byt i dont work with \BR and not with \N

i tried both !

Frank
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String benchMark = "Test1\ntest2\ntest";
String benchMark1 = "Test1
ntest
ntest";

Gives me one line on the page, and not 3 lines as i want to ops:


Frank
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well,

the question is: you see one line on your browser? Or you see one line as html source from your browser?
Moreover, you should try with:


In this case, what do you get?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linebreaks in HTML are to be represented with <br>.
The h:outputText by default escapes HTML/XML.
If you want to display plain HTML using h:outputText, you need to set 'escape' attribute to 'false'.
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh, that was the answer that i want, and it works !

Im happy

Frank
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!