개발/JAVA

Java | Page directive must not have multiple occurrences of pageencoding

AM0530 2021. 9. 23. 15:17

1. 오류상황 : 사진 첨부시 아래와 같이 오류 메시지 뜨면서 업로드 안됨 

 - 오류 메세지 : [가이드] 사진 업로더랑 서버 URL 셋팅이 필요합니다. -onAjaxError

- 이클립스 console 오류 메세지 : 

Sep 23, 2021 3:01:41 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [/***/***/file_uploader_html5.jsp (line: [9], column: [1]) Page directive must not have multiple occurrences of pageencoding] with root cause
org.apache.jasper.JasperException: /***/***/file_uploader_html5.jsp (line: [9], column: [1]) Page directive must not have multiple occurrences of pageencoding
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:470)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:106)
at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:198)

 

2. 원인 : file_uploader_html5.jsp에 contentType이 2번 써있었다 

3. 해결방법 : 중복된 contentType 삭제 (9line 삭제) 

 

- 참고 : 

https://sarc.io/index.php/tomcat/278-jsp-page-directive-illegal-to-have-multiple-occurrences-of-contenttype-with-different-values

 

JSP 처리 중 Page directive: illegal to have multiple occurrences of contentType with different values

[{"id":"13","listid":"1","parentid":"0","videosource":"youtube","videoid":"KiwjxNKXfxY","imageurl":"https:\/\/i.ytimg.com\/vi\/KiwjxNKXfxY\/default.jpg,120,90;https:\/\/i.ytimg.com\/vi\/KiwjxNKXfxY\/mqdefault.jpg,320,180;https:\/\/i.ytimg.com\/vi\/KiwjxNKX

sarc.io