• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic