시스템아 미안해

xml에서 파일 업로드 설정 :: servlet-api, web-app 3.1로 변경 본문

web

xml에서 파일 업로드 설정 :: servlet-api, web-app 3.1로 변경

if else 2022. 12. 14. 13:48

파일을 업로드 하기 위해 multipartResolver bean을 servlet-context에 추가하고, 

pom.xml 에 servlet을 3.1을 build하려니 web-app의 버전도 같이 맞춰줘야 했다. 

 

 

[pom.xml]

<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
			<scope>provided</scope>
</dependency>

 

 

 

[web.xml] 

web-app별 dtd를 검색해서 상단 dtd를 3.1로 맞춰주고, 

<web-app id="WebApp_ID" version="3.1" 
		xmlns="http://xmlns.jcp.org/xml/ns/javaee"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

 

 

 

그제서야 <multipart-config>에 빨간 줄이 사라졌다.

<servlet>
<multipart-config>
			<max-file-size>31457280</max-file-size> <!--30mb-->
			<max-request-size>1004857600</max-request-size><!--100mb--> 
</multipart-config> 
</servlet>

 

 

 

'web' 카테고리의 다른 글

URL경로 설정  (0) 2023.01.26
JSP vs Thymeleaf  (0) 2022.09.24
웹경로, context path, 절대경로, 상대경로  (0) 2022.07.10
유튜브 노마드코더 - graphQL 쓰는 이유 (Rest API의 단점)  (0) 2022.06.07
URL과 도메인, 그리고 DNS  (0) 2022.06.03