Không hiện ảnh ra màn hình, code java jsp servlet

file demoUploadFile.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Upload file</title>
</head>
<body>
	<h1>Upload your file</h1>
	<hr />
	<form action="demoUploadFile" enctype="multipart/form-data" method="post">
		File: <input type="file" name="image" placeholder="Image" /> <br />
		<input type="submit" value="Upload" />
	</form>
</body>
</html>

file demoUploadFile.java

package Demo;

import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;

//import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;

@WebServlet("/demoUploadFile")
@MultipartConfig
public class demoUploadFile extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		try {
			Part part = req.getPart("image");

			String realPath = req.getServletContext().getRealPath("/images");
			String fileName = Path.of(part.getSubmittedFileName()).getFileName().toString();

			if (!Files.exists(Path.of(realPath))) {
				Files.createDirectory(Path.of(realPath));
			}

			part.write(realPath + "/" + fileName);
			try (PrintWriter print = resp.getWriter()) {
				print.println("<img src='images/" + fileName + "' width='80' height='80'>");

			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

em thực hành code như trên. khi chạy ra thì màn hình không hiện ra ảnh. mong mọi người trợ giúp

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?