๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ๋ฐœ/JAVA

[JAVA] The method getRealPath(String) from the type ServletRequest is deprecated

by ynzu๐Ÿค 2022. 3. 11.
๋ฐ˜์‘ํ˜•

 

WEB-INF ๊ฒฝ๋กœ์— ์žˆ๋Š” ํŠน์ • ํŒŒ์ผ์˜ ์ ˆ๋Œ€๊ฒฝ๋กœ๋ฅผ ๊ฐ€์ ธ์˜ค๋ ค๊ณ  ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ–ˆ๋Š”๋ฐ 

'The method getRealPath(String) from the type ServletRequest is deprecated'๋ผ๋Š” ๊ฒฝ๊ณ  ๋ฌธ๊ตฌ๊ฐ€ ํ‘œ์‹œ๋˜์—ˆ๋‹ค.

request.getRealPath("/WEB-INF/xxx/xxx.txt");

 

ํ•ด๊ฒฐ๋ฐฉ๋ฒ•

request.getSession().getServletContext().getRealPath("/WEB-INF/xxx/xxx.txt");

 

jsp์—์„  ์•„๋ž˜์™€ ๊ฐ™์ด ๋ฐ”๊ฟ”์ฃผ๋ฉด ๋œ๋‹ค!

application.getRealPath("/WEB-INF/xxx/xxx.txt");

 

728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€