解决的方法是:在每个JSP的头上加上一段代码 <%@ page trimDirectiveWhitespaces="true" %> 转载于:https://www.cnblogs.com/liughost/p/3967031.html