반응형
이미지가 깨져서 나오지 않을 경우가 많다.
이 경우에는 우선 파일 저장 경로를 확인한다.
private static final String SAVE_PATH = "C:\\dev1\\file";
private static final String PREFIX_URL = "/upload/";
저장 경로와 가상 경로를 두가지 경로로 지정한다.
SAVE_PATH는 실제 저장 경로이다.
실제 저장 경로로 이미지를 호출 할 수 없기 때문에 가상 경로를 지정한다.
TOMCAT -> SERVER.XML 설정해준다.
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Context path="/upload" docBase ="C:\dev1\file\" reloadable="true"></Context>
HOST 바로 밑에 설정해주시고
화면은 아래와 같이 지정한다.
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
${imgUrl}
<img alt="logo" src="${imgUrl}" width="300" height="300"/>
</body>
</html>
결과 출력
반응형
'Deep learning > 오류해결' 카테고리의 다른 글
20201125- IProgress not found. Please update jupyter and ipywidgets (0) | 2020.11.25 |
---|---|
20201112-django pytorch cuda out of memory (0) | 2020.11.12 |
20201110-Required request part 'file' is not present (0) | 2020.11.10 |
spring-Exiting from "FORWARD" dispatch, status 404 (0) | 2020.11.09 |
No module named 'yaml' (0) | 2020.10.28 |