Meaningless Drivel is fun!*
The moose likes JSP and the fly likes print string with breaks on web page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "print string with breaks on web page" Watch "print string with breaks on web page" New topic
Author

print string with breaks on web page

sudheshna Iyer
Ranch Hand

Joined: Aug 20, 2004
Posts: 71
I have a string like "aaa
bbb
ccc". I want to print that as :
aaa
bbb
ccc
on to the web page.
When I use the following code. I see it get printed as "aaa
bbb " and when I view the source,
I see it as "aaa</br>bbb". How can print them with breaks.

Code:
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
First: your HTML syntax is invalid. Write valid HTML.
Second: the c:out by default escapes XML/HTML. Leave it away or set its escapeXml attribute to false.
Third: using scriptlets is a bad practice, use taglibs/EL only.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: print string with breaks on web page