JSP를 코딩하다 보면 클라이언트에서 소스보기 시 html 문서에 공백행이 상당히 많음을 확인할 수 있다.
이러한 whitespace 라인을 없애는 방법을 기록한다. 답은 web.xml의 수정에 있다.
XML 태그 <web-app></web-app> 사이에 삽입하면 된다.
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>
'Computer Science > JSP & Servlet' 카테고리의 다른 글
URL URI 관련 메모 (0) | 2021.04.04 |
---|---|
JSP Tomcat 서버 한글 깨짐 해결 방법 (UTF-8 인코딩 설정) (0) | 2021.02.15 |