Remove Whitespace From HTML / JSP / JSF

Remove Whitespace From HTML / JSP / JSF explains about implementing a servlet filter for removing whitespace & blank lines from your html/jsp/jsf output, which will reduce the payload and improve the overall web application performance

If you need a solution for below questions

How To Remove Whitespace From Response In Your Java Web Application?
How To Remove Whitespace From JSP/JSF And HTML?

then servlet filter will be the right choice, because by using servlet filter, we can implement this in a single place rather than on implementing every page

if you dont know about Servlet Filter, you can follow servlet filter Tutorial Here I am using, whitespace removing filter available from http://balusc.blogspot.in/2007/12/whitespacefilter.html

By using this filter you can strip/trim whitespace & newline characters from your html/jsp/jsf pages without losing actual contents

Java GZIP Compression Filter Example

Java GZIP Compression Filter Example explains about implementing a GZIP compression filter for optimizing web application performance

How To Compress HTML Content Using Gzip Servlet Filter?

GZIP is compression algorithm used for compression text files such as HTML, JavaScript, CSS etc, Which will reduce the data (bandwidth) sent to browser

Here we are discussing about implementing Gzip Compression Filter using Java Servlet Filter, if you don't know about Servlet Filter, you can follow servlet filter Tutorial

By implementing GZIP compression, will dramatically improve web application performance and reduce download time.

For availing GZIP compression, your browser must support GZIP compression, you need to set Accept-Encoding request header

Servlet Filter Tutorial

Java Servlet Filter Tutorial explains step by step details of creating a Servlet Filter using Eclipse

Servlet filter filter dynamically manipulate both requests as well as responses and to modify the object contained in the requests or responses

Typically Servlet Filters do not create responses, but they provide universal operations which can be a part of any type of JSP or servlet

Here we are showing an example of hitCounter, so that we can count the exact number of visitors for a site. Here hitcount variable is increased on each request.

You can see the below example, which is demonstrating Servlet Filter Tutorial