0

I am using HTTPservlet to handle requests from a user

this is the content of the doget method

RequestDispatcher requestDispatcher = request.getRequestDispatcher("/Blog.jsp");

Blog.jsp file

<body>
   <h1><%= "Hello World!" %></h1>
   <br/>
   <img src="">
</body>

I have a image in my Oracle database that I want to upload it into that img element.

And to be more specific I don't want to upload it into a file in my project and than put that file path inside that img element

is that possible?

Mehdi Rahimi
  • 1,453
  • 5
  • 20
  • 31
  • Did you consider making a separate servlet for the image file? That way you can point your image src to that servlet, and have it return the byte stream. – Kraylog Apr 24 '22 at 06:01
  • @Kraylog Yes, I thought about that, and it really helps me. The problem is that I did not find the correct code for that servlet i tried so many time, can you help me if you have the code please – just study Apr 24 '22 at 08:57
  • You can use `src="data:image/png;base64, BASE64 ENCODED IMAGE HERE` – dan1st Nov 15 '22 at 07:22

0 Answers0