在jsp中显示来自数据库mysql的图像[重复]

时间:2022-09-25 16:43:20

This question already has an answer here:

这个问题在这里已有答案:

How I can display image from database MySQL in JSP?

如何在JSP中显示来自数据库MySQL的图像?

And, how can I store the image in the database and not the path of it? I use only Servlet and JSP .

而且,我如何将图像存储在数据库中而不是它的路径中?我只使用Servlet和JSP。

1 个解决方案

#1


0  

You would need to store the image as a BLOB in the database. Later read the BLOB back and display it to the client. This link shows an example of storing images in Oracle DB. However, if you want to store too many images, I would think storing them on file system and the path in the DB is a better option. You should take a look at this SO post.

您需要将图像存储为数据库中的BLOB。稍后再读回BLOB并将其显示给客户端。此链接显示了在Oracle DB中存储图像的示例。但是,如果您想存储太多图像,我会认为将它们存储在文件系统中,而DB中的路径是更好的选择。你应该看看这篇SO帖子。

#1


0  

You would need to store the image as a BLOB in the database. Later read the BLOB back and display it to the client. This link shows an example of storing images in Oracle DB. However, if you want to store too many images, I would think storing them on file system and the path in the DB is a better option. You should take a look at this SO post.

您需要将图像存储为数据库中的BLOB。稍后再读回BLOB并将其显示给客户端。此链接显示了在Oracle DB中存储图像的示例。但是,如果您想存储太多图像,我会认为将它们存储在文件系统中,而DB中的路径是更好的选择。你应该看看这篇SO帖子。