Author
outputText i want to split a string whith <br/> or /n dosent work ?
Frank Jacobsen
Ranch Hand
Joined: May 17, 2002
Posts: 335
posted Jan 20, 2009 02:31:55
0
I have a jsf page with this outputText:
<h utputText 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
Joined: May 14, 2007
Posts: 244
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.
SCJP<br />SCWCD 1.4 Upgrade (Remember: me stupid)<br />SCWCD 1.4<br /><a href="http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html" target="_blank" rel="nofollow">SCBCD 5.0</a><br /><a href="http://www.enthuware.com" target="_blank" rel="nofollow">SCBCD 5.0 mock exam</a> <br /> <br />SCEA 5 Part1: Preparing...
Frank Jacobsen
Ranch Hand
Joined: May 17, 2002
Posts: 335
posted Jan 20, 2009 03:59:43
0
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
Joined: May 17, 2002
Posts: 335
posted Jan 20, 2009 04:03:53
0
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
Joined: May 14, 2007
Posts: 244
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
Joined: Oct 08, 2006
Posts: 2458
posted Jan 20, 2009 04:24:59
0
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'.
Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
Frank Jacobsen
Ranch Hand
Joined: May 17, 2002
Posts: 335
posted Jan 20, 2009 04:52:51
0
Ahh, that was the answer that i want, and it works !
Im happy
Frank
subject: outputText i want to split a string whith <br/> or /n dosent work ?