aspose file tools
The moose likes JSF and the fly likes outputText i want to split a string whith <br/> or /n dosent work ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "outputText i want to split a string whith <br/> or /n dosent work ?" Watch "outputText i want to split a string whith <br/> or /n dosent work ?" New topic
Author

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

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 335
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

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
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
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
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
Ahh, that was the answer that i want, and it works !

Im happy

Frank
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: outputText i want to split a string whith <br/> or /n dosent work ?
 
Similar Threads
Limit characters returned in H:Outputtext?
help me to make menu list float in CSS
Printing formatted text to the user
Use a UseBean id within a scriptlet
Custom Tag won't display the attributes