Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get line Break in Servlet output

 
Manjesh Patil
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have the following requirement





When I write this to browser from servlet, the output will be printed in the same line but I am expecting in two lines (in text form not HTML form which can be achived using <br/>).
If I use System.out.println(s) , it prints as I am expecting.

I have tried the following things but no gain!



Also I have noticed one thing that . I am using JRE6 WINDOWS 7 and ECLIPSE
is this the problem?

can someone help me..?
thanks in advance
Ma
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manjesh Patil wrote: the output will be printed in the same line

I doubt that it is printing output. since you are creating PrintWriter Object. you should flush the output stream, after the write
 
Manjesh Patil
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for Reply

yes ...there is . It writes the output but in single line.............

how to configure these outputstreams so as to consider the new line character?

-thanks
Ma
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think! Stop, and think!

Where is the output being sent? Answer: to a browser.

So what does the browser do with the line break?
 
Bill Li
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should encode these strings when you output to the brower.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill Li wrote:I think you should encode these strings when you output to the brower.

No.

What creates a line break in the browser? Not the answer: a new line. So what is the answer?
 
vinayak jog
Ranch Hand
Posts: 83
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the tag which used to break the line..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic