Archive for June 10th, 2009

Good Thread on White Space in JSPs

Wednesday, June 10th, 2009
No Gravatar

While it is tempting to quickly skim an blog entry for the information I’m seeking at the time, a recent find on dealing with white space with JSPs reminded me that there is a darn good reason most blogs have a comment feature.

The thread I’m talking about is Trim Spaces in Your JSP at Raible Designs. Fortunately, my paranoia paid off, and I did not try this setting blindly on the project where I was looking for such an answer (and have since rolled off). I almost did, but decided not to because I knew I would not be around to support the change, and that whoever I told about it may forget it. As it is a performance enhancement and the application had some peformance issues (too many cooks in the presentation layer kitchen IMHO), it was not as easy of a call as it may seem.

The con that comes up in the comments on that post is that it wipes all white space between tags. If I were the only person developing on the project, or if was a small team where I knew for certain that only experience JSP developers were working on the JSPs, I’d still feel safe. This is because if a space has to be in a page between two dynamic parameters, the experienced JSP developer will use an entity code rather than just a blank space.

There is also a comment in the thread about how to cut down white space in a build file. That was actually the type of solution I was seeking at the time (and missed at the time).  I would have to experiment with the solution before I suggested it, but it looks like what I wanted.