[JSTL] Generated HTML too large (whitespace)

K

Karsten Wutzke

Hi all!

When generating HTML code from the template JSP/JSTL files, I keep my
code well indented. However, this makes *a lot* of whitespace, so that
simple pages end up being 189KB and so on. This is really bad for
everything.

Is there any kind of server setting that removes all whitespace before
seding back the code? Or maybe some other way?

I just hope I don't have to make one lined JSP files just to achieve that...

Karsten

PS: Sorry, this might be a little OT.
 
B

Ben_

This can be done in several ways:
.. at the web container level:
. implement a servlet filter to trim the spaces after your servlet/jsp
is called (maybe such filter already exists)
.. at the http server level:
. an Apache mod could do it (don't know for sure, but chances are that
an mod already exists for this)
. gzip the traffic (Apache has plug-ins for that), but drawback: when
you sniff traffic, all you see is zipped...
 
R

Roedy Green

Is there any kind of server setting that removes all whitespace before
seding back the code? Or maybe some other way?

I have a class called Compactor that removes non-significant
whitespace.

I use it in the Replicator to prepare files for export. I also use it
on my website. I have not got around to distributing it yet as a
separate product. Ditto with untouch, the program that redates files
back to their original if they have not really changed, which is also
part of the Replicator. I also have an HTML macro scheme that lets
you write macros in Java for expansion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top