This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSP and the fly likes print string with breaks on web page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply 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: 66
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.


Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: print string with breaks on web page
 
Similar Threads
mysql & incomplete insertions!
need help on passing string
Xpath
Table nested inside a div
pagination for forEach of JSTL List