• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ant and JSP Whitespace  RSS feed

 
J Collins
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there,

First time poster here. I am hoping someone else has come across this and had to deal with it in the past. Basically, we are running on ATG at the moment, and our ant tasks perform precompile on the JSP pages. The way ATG works, when the pages are compiled there is a ton of whitespace. We are trying to figure out a way to possibly clean up alot of that whitespace during the ant precompile (or possibly by some other means).

Anyone have any ideas on this?

Thanks in advnace for any replies

- Jason
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The whitespace is just the way JSP works. Anything not within server-side tags is considered template text -- including returns and other whitespace -- and is faithfully preserved in the output.

If it violates your sensibilities, you could run a utility to remove all the whitespace before the pre-compile, or write a servlet filter that would elide the whitesapce when the JSP is served.

Personally, I don't let it bother me.
 
J Collins
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't let it bother me either, but our clients view the source alot apparently and it bothers them, lol. I will see what I can do with your suggestions.

Thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the HTML is auto-generated by the container, looking at and commenting on the formatting of the HTML source sent to browser makes no sense at all. I'd find a nice, professional way to tell the clients this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!