This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, Has any one faced any problem with the new line characters at the beginning of the JSP output?(Click view source on the HTML page generated by the JSP, and you will see that the actual output - the <HTML> tag starts after a few new line characters). Well, this is causing a problem for me, and I'd like to get rid of these new line characters. Did any one of you ever face this issue? Any help will be greatly appreciated. Thanks. -Bala.
Browsers are supposed to ignore white space. But in truth it doesnt work that way. Specially if you have too much white space. I had a html table being populated by jsp. Where I had significant java code. All the white space created a empty space of about 15% of screen height above the table tag. Only way to remove it was to rearrange the jsp as <% ---Java Code <-cr %><---- html code. My jsp looks awful.
Joined: Jan 26, 2001
Thanks for all the responses. My problem is very peculiar. I have a server side Java class which 'hits' some JSPs, exchanging data via the request variable, and writes out results to a file. The JSPs do not have any HTML or out.print code. But, the new lines characters returned from the JSPs were introducing new line chars at the beginning of the file, causing some application errors. Anyways, I've found a simpler and dirty solution to this. Add out.clear() to the code in the JSPs just before you send any output to the browser, and that removes the \ns. Thanks again.