-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Curtis,
On 10/16/2009 9:49 AM, Curtis Garman wrote:
> That's what I ended up doing and I believe that took care of it...but
> I figured if it is an apache recommended setting that it should also
> work :)
Well, it does work... just not the way you expected it to work :)
The documentation for the 'trimSpaces' property is:
trimSpaces - Should white spaces in template text between actions or
directives be trimmed ?, default false.
If you have this in your JSP:
${firstName} ${lastName}
... then the JSP compiler will remove the spaces between the directives
and give you this instead:
${firstName}${lastName}
This obviously renders the two pieces of data without an intervening
space. Using a newline between them is no better because it's also
whitespace.
The setting does say "trimmed" and not "removed". I would have expected
all spaces between directives and actions to be "normalized" as per the
XSLT definition (which is that any spaces are collapsed into a single
space, but the whitespace spacing still remains). Basically, this gives
you what you want pretty much all the time.
Perhaps it's a bug.
Looking at the source for 6.0.20 (I don't have 5.5.25 handy right now),
this is the code I think is relevant for this:
if ((options.getTrimSpaces() ||
pageInfo.isTrimDirectiveWhitespaces())
&& n.isAllSpace()) {
n.setText(emptyText);
return;
}
As you might imagine, emptyText is defined as:
private final String emptyText = new String("");
(What a waste of space, by the way: new String("") essentially creates
two strings: one UTF-8 sequence in the constant pool and then another
object wrapping that... why not just use "" directly in the code? It's
more straightforward and probably better optimized by a compiler).
Anyhow, it probably makes sense to change the "emptyText" string from ""
to " " (that is, use a space instead of nothing).
This bugzilla entry might be interesting to you:
https://issues.apache.org/bugzilla/show_bug.cgi?id=45931
If explains the problem, why it exists, and that Tomcat might end up
with a patch to meet your needs... but possibly not to the 5.5 branch
(this has been reported against 6.0).
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrYlE0ACgkQ9CaO5/Lv0PAzTQCeKgxp3nFrKIFBssjY53tDOZ9d
qmcAnA5TAO3Ha2M1RiaeY1bBDZFGlKdc
=h0ND
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]