Discussion:
Removing whitespace from JSPs?
(too old to reply)
j***@sbcglobal.net
2007-01-11 21:23:10 UTC
Permalink
One of the problems we've had lately with the Commerce JSPs is the huge amounts of whitespace they generate. If you do a 'view source' you will see large chunks of whitespace which is unnecessary and ugly.

I thought at one point I used an Apache mod to remove the whitespace, but I cannot for the life of me remember what mod it was. The compression module will compress the page but won't physically remove the whitespace before sending.

I tried adding a trim filter servlet I found on the web, but for some reason periodically the LikeMindFilter throws and exception when we use the trim filter (the trim filter is set to filter on the Store Servlet, not Like minds, so I assume its just a weird problem with the filter chains).

Does anyone have a good solution to removing whitespace that works well with Commerce (5.6.1)?

Removing the whitespace manually and removing carraige returns in the JSPs is not an option. We still need to be able to view the JSPs in our development environment with proper formatting.
geo
2007-01-16 14:14:48 UTC
Permalink
The way we have been doing this for years is to compress the page coding

For instance, do all imports on a single line, that should remove a majority
of your whitespace from the top of the pages.

Best regards,
George
Post by j***@sbcglobal.net
One of the problems we've had lately with the Commerce JSPs is the huge
amounts of whitespace they generate. If you do a 'view source' you will
see large chunks of whitespace which is unnecessary and ugly.
I thought at one point I used an Apache mod to remove the whitespace, but
I cannot for the life of me remember what mod it was. The compression
module will compress the page but won't physically remove the whitespace
before sending.
I tried adding a trim filter servlet I found on the web, but for some
reason periodically the LikeMindFilter throws and exception when we use
the trim filter (the trim filter is set to filter on the Store Servlet,
not Like minds, so I assume its just a weird problem with the filter
chains).
Does anyone have a good solution to removing whitespace that works well
with Commerce (5.6.1)?
Removing the whitespace manually and removing carraige returns in the JSPs
is not an option. We still need to be able to view the JSPs in our
development environment with proper formatting.
Nicolai Dufva Nielsen
2007-01-16 14:35:25 UTC
Permalink
...and a way to do this while keeping the page somewhat readable in a
text editor is to add the line breaks inside the JSP tags, as in:

<%@ page language="java"
%><%@ page import="...."
%><%@ ....etc... %>

/Nicolai
Post by geo
The way we have been doing this for years is to compress the page coding
For instance, do all imports on a single line, that should remove a majority
of your whitespace from the top of the pages.
Best regards,
George
Post by j***@sbcglobal.net
One of the problems we've had lately with the Commerce JSPs is the huge
amounts of whitespace they generate. If you do a 'view source' you will
see large chunks of whitespace which is unnecessary and ugly.
I thought at one point I used an Apache mod to remove the whitespace, but
I cannot for the life of me remember what mod it was. The compression
module will compress the page but won't physically remove the whitespace
before sending.
I tried adding a trim filter servlet I found on the web, but for some
reason periodically the LikeMindFilter throws and exception when we use
the trim filter (the trim filter is set to filter on the Store Servlet,
not Like minds, so I assume its just a weird problem with the filter
chains).
Does anyone have a good solution to removing whitespace that works well
with Commerce (5.6.1)?
Removing the whitespace manually and removing carraige returns in the JSPs
is not an option. We still need to be able to view the JSPs in our
development environment with proper formatting.
s***@in.ibm.com
2007-01-25 06:03:13 UTC
Permalink
The whitespaces are created inside the JSPs due to huge amount of Scriplet code. Use JSTL instead of Scriptlet. That will reduce most of the whitespaces in your JSP. JSTL is supported by WebSphere Commerce v5.6.1 and other versions as well.
Continue reading on narkive:
Loading...