-1
다음 서블릿 메소드를 통해 mysql 데이터베이스에서 이미지 바이트를 검색합니다.jsp에서 이미지를 표시하는 방법
이미지 바이트를 JSP 페이지에 표시합니다.
내 JSP 페이지에서 img 태그를 어떻게 사용합니까?
public byte[] getProfilePicture(int id) {
byte[] bytes = null;
try {
connection = dataSource.getConnection();
pst = connection.prepareStatement("SELECT profile_picture FROM users WHERE id = '"+id+"' ");
resultSet = pst.executeQuery();
while(resultSet.next()) {
bytes = resultSet.getBytes("profile_picture");
}
} catch(Exception e) {
e.printStackTrace();
}
return bytes;
}
덕분에, 나는 당신의 친절한 응답을 기다리고 있습니다.