• Post Reply Bookmark Topic Watch Topic
  • New Topic

is it possible to have JSP engines not produce superfluous linebreaks?

 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All JSP engines I have used (Tomcat 2,3,4,5, iPlanet, Orion, SilverStream) produce a lot of empty lines and linebreaks in the generated output (specifically one for every JSP codeblock or tag).
To me the output looks ungainly, which is a minor gripe.
Someone else mentioned somewhere that it's a potential security risk which I find highly questionable (the .jsp extension would be a dead giveaway after all as to the tech in use ).
But the main problem now is that all those breaks make the generated code quite a bit longer. As the application I'm working on now is targeted at PDAs operating over a GPRS connection (thus a relatively slow connection with a hefty charge per volume of data) I am aiming to reduce the generated HTML to the absolute minimum.
I've already reduced form variable names to single letters, will do the same with CSS styles, and have removed all HTML comments and many linebreaks.
Only 2 areas still to be updated: indentation (which will go once the code is stable) and those breaks generated by Tomcat.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rather than trying to do this in your code (which can make the pages hard to maintain), I'd look into creating a servlet filter that would post-process the response, removing the uncessessary whitespace and performing any other optimizations that would help.
Does your client support gzipped streams?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!