Reputation: 23276
The following servlet code,gets the image bytes from the database's table.
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Configuration config = new Configuration().configure();
SessionFactory sessFact = config.buildSessionFactory();
Session sess = sessFact.openSession();
pojo.File image_file = (pojo.File)sess.get(pojo.File.class, 2);
byte image_file_bytes[] = image_file.getFiles_uploaded();
// NOW WHAT ? HOW DO I MAKE IT DISPLAY IN THE BROWSER ?
}
I have the bytes
. What do I do next to display image on to the browser ?
Upvotes: 0
Views: 84
Reputation: 13057
You use the OutputStream of the HttpServletResponse to write the data out.
Upvotes: 1