JSP에서 LINE 공백(white space) 제거하는 방법


JSP에서 LINE 공백(white space) 제거하는 방법

JSP를 사용하다 보면 JSTL이 있던 자리가 HTML로 변경되고 나서 빈 줄 ( white space )로 남아있는 것을 보게 된다. 이 경우 에러가 발생하지는 않지만 디버깅을 할 때 코드의 line 수가 너무 많아서 브라우저가 멈춰버리는 경우가 발생한다. 이것을 해결하는 방법은 아래 3가지가 있다. 1. JSP에 선언하는 방법 <%@ page trimDirectiveWhitespaces="true" %> 2. web.xml에 설정하는 방법 <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <trim-directive-whitespaces>true</trim-directive-whitespaces> </jsp-property-group> </jsp-config> 3. Tomcat의 conf/web.xml에 설정하는 방법 <init-param> <param-name>trimSpaces</param-name> <pa...



원문링크 : JSP에서 LINE 공백(white space) 제거하는 방법