How to remove the blank lines left by Jstl tag Library "include, taglib" in JSP

Source: Internet
Author: User
Tags config include trim

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> &Lt;/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/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.