When doing the project, often use to Jstl and El expression, sometimes we need to look at the page generated source code, but when the JSP is full of jstl of various tags, the page will have a lot of blank parts, sometimes too many will let the browser suspended animation, this is we want to remove these blank parts. There are many ways to get rid of them, listed below.
My development and Server environment: Windows7 + Eclipse2014 + Tomcat7.0 + JDK 1.7.0
After multiple tests, the available methods are:
1. Add a piece of code to the head of each JSP <%@ page trimdirectivewhitespaces= "true" %>
2. Add a JSP script code on the page <%out.clear ();%>
3. Add the following configuration to the project's Web. XML
4.Configuring Web. Xml with Tomcat
<servlet> <ser Vlet-name>jsp</servlet-name> <SERVLET-CLASS>ORG.APACHE.JASPER.SERVLET.JSPSERVLET</SERVLET-CLA ss> <init-param> <param-name>fork</param-name> <param-value& gt;false</param-value> </init-param> <init-param> <param-name>xp Oweredby</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>trimspaces</param-nam E> <param-value>true</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet>
Note: You need to clear the re-release to start the role!
Step: Stop,clean...,publish,start
I tried it just in the beginning. All methods do not work, only to think of republishing.