Search code examples
jspparametersstriphtml

How can you strip HTML comments out of a page generated with JSP/JSTL?


I know some people use ANT to accomplish this, but I don't want to remove HTML comments from the actual jsp, I just want a way to strip them from output unless a users adds a parameter to the url to show the comments for debugging.


Solution

  • Here is HTMLCompressor lib that can be called either from code or as JSP tag to strip comments and more.