File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes java new line not recognized in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "java new line not recognized in jsp" Watch "java new line not recognized in jsp" New topic
Author

java new line not recognized in jsp

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
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

Joined: Jun 11, 2007
Posts: 327
: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

Joined: Jan 10, 2002
Posts: 60041
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: java new line not recognized in jsp
 
Similar Threads
Overhead IO : The cryptic case of the extra bytes
passing hidden forms problem
Oracle table takes Null
unable to get response from payment website
java.lang.IllegalStateException: getOutputStream() has already been called for this response