A source of annoyance with the JSP output, where all the JSP directives are replaced with blank lines in the final output has been addressed in JSP 2.1. Now if you want to get rid of all the blank lines in your JSP output, simply add the line <%@page trimDirectiveWhitespaces="true"%> to the top of your JSP. I wish this was the default.
November 13, 2009 at 11:49 am |
Thanks a lot. I was stuck with exactly this problem and the solution given here worked wonderfully well. Thanks again Shahram.
November 13, 2009 at 7:21 pm |
You’re welcome Vignesh.
March 18, 2010 at 9:23 am |
Thanks for this little hint. I’ve already known the option to suppress blank lines per web.xml but in my special case I needed it for only one JSP file.
But one question remained: Eclipse marks this attribute with an “undefined attribute name” warning but in my webapp it works exactly as expected. Any idea?
Thanks again, Florian
November 3, 2010 at 6:58 pm |
I’ve been looking into how to remove the warning in eclipse as well,but so far no luck. Let me know if you figure this out.
February 4, 2011 at 2:43 pm |
thanks a lot.
February 4, 2011 at 5:59 pm |
You are welcome.
January 3, 2012 at 1:46 pm |
there is another solution.
Add this to your web.xml:
………
*.jsp
true
……………………
January 3, 2012 at 1:49 pm |
you shuld configurate your filter becouse it didn’t work as expect
February 21, 2012 at 9:17 am |
This tag only works for JSP 2.1 onwards. for earlier version any solution?
October 17, 2012 at 12:30 pm |
Thankyou!
December 11, 2012 at 5:04 am |
Oh, Thankyou!
January 21, 2013 at 12:01 pm |
Thank you very much!!
May 17, 2013 at 4:47 pm |
Thanks from me too. Page from 2007 still helpful in 2013!