The Jstl and El expressions are often used when doing projects, sometimes we need to look at the source code generated by the page, but when the JSP is full of jstl of the various tags, the page will have a lot of blank parts, sometimes too much will let the browser suspended animation, this is we want to remove these blank parts. There are a lot of ways to remove 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 section of code to the header of each JSP <%@ page trimdirectivewhitespaces= "true"%>
2, add a JSP script code on the page <%out.clear ();%>
3. Add the following configuration to the web.xml of the project
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
< trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
< /jsp-config>
4. Use Tomcat configuration Web.xml
<span style= "color: #333333;" > <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.a Pache.jasper.servlet.jspservlet</servlet-class> <init-param> <param-name>f
Ork</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>xpoweredBy</param-name> <param-va lue>false</param-value> </init-param> </span><span style= "color: #ff0000;" ><strong><init-param> <param-name>trimSpaces</param-name> <p aram-value>true</param-value> </init-param></strong></span><span style= "color:# 333333; " ><strong> </strong> <load-on-startup>3</load-on-startup> ≪/servlet></span>
Note: You need to clear the redistribution to restart!
Step: Stop,clean...,publish,start
I've been trying to get started. All methods have no effect on the idea of republishing.
This column more highlights: http://www.bianceng.cn/webkf/JSP/