-
jsp 경로를 이동하면 파일 다운로드 받는 방법WEB/JSP 2018. 10. 23. 20:50
contet.jsp 라는 파일 상단에 <%@ page contentType="application/msword" %>를 삽입하면 웹에서 해당 도메인 주소로 접속 하면 다운받겠다는 의사여부를 붇지않고 바로 다운 받는다.
content.jsp
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="application/msword" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>title</title>
<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
<style>
</style>
<script>
</script>
</head>
<body>
</body>
</html>
<%@ page contentType="application/msword" %> 이 부분에서 msword가 아닌 exe로 바꿔서 접속을 해도
동일한 결과를 나타낸다.
'WEB > JSP' 카테고리의 다른 글
Request 객체의 메소드 사용하여 웹브라우저와 서버의 정보를 출력하는 예제 (0) 2018.10.24 jsp include file 응용 (0) 2018.10.23 JSP 에러페이지 (0) 2018.10.23 web.xml 파일이 없을때 해결법 (1) 2018.10.23 eclipse에서 mysql 연동 에러 문제 (0) 2018.10.19 댓글