Looking at the blank lines in the header of the jsp page is not very nice. If you want to remove it, remember that the front blank lines are not allowed during wap.
The method is as follows:
First:
The code is as follows: |
Copy code |
<% Out. clear (); %> |
Disadvantages the latter part should keep up with the forward indent and not push, mainly because you are still using a blank line for the time being.
Second:
Jsp page command settings:
The code is as follows: |
Copy code |
<% @ Page trimDirectiveWhitespaces = "true" %> |
Third:
Or you can configure it in the configuration file web. xml so that this attribute does not need to be set for all pages in the project.
The code is as follows: |
Copy code |
<Jsp-config> <Jsp-property-group> <Url-pattern> *. jsp </url-pattern> <Trim-directive-whitespaces> true </trim-directive-whitespaces> </Jsp-property-group> </Jsp-config> |
If Tomcat is Tomcat 5.x, that is, the JSP2.0 and Servlet2.4 specifications, add the following to the web. xml configuration:
The code is as follows: |
Copy code |
<Servlet>
<Servlet-name> jsp </servlet-name> <Servlet-class> org. apache. jasper. servlet. JspServlet </servlet-class> <Init-param> <Param-name> trimSpaces </param-name> <Param-value> true </param-value> </Init-param> <Load-on-startup> 3 </load-on-startup> </Servlet> |