Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java new line not recognized in jsp

 
Harshana Dias
Ranch Hand
Posts: 337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have just use System.out.print("\n") in a for each iteration expecting new lines as if we put
. Any reason why it does not work with System.out.print("\n")

 
Harshana Dias
Ranch Hand
Posts: 337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:banghead: though in server side new line interprets and add a new line, but when it comes to client side browser skips the empty lines. So it displays in a row instead of breaking in to lines.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that all a JSP does is to create an HTML page to send to the browser. So yes, the browser ignores white-space in HTML. Also System.out.print does not even emit the output to the response. It'll just send it to the console/log.

If that seems odd to you, this article might help.

Also, scriptlets in a JSP are obsolete and discredited. Please read this JspFaq entry.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic