• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display output in New Line using servlets

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I am new to this group.
Just need to know how to display output in the newline using servlets.
As \n works fine in java, but it doesn't seem to be working in servlets.
Is there any other escape sequence or way to do the same.


Kindly suggest.
Thanks & regards,
Vineet
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your servlet output is most likely being interpreted as HTML by the browser. You need to either tell the browser that you are sending plain text (by setting the content type header appropriately) or generate HTML markup to display the text with the formatting you desire.
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which, to state the obvious, is the <br /> tag for newlines.

If your output is already white space formatted, then you can wrap the HTML tag <pre> </pre> around your output.
 
reply
    Bookmark Topic Watch Topic
  • New Topic