By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

Retriving Image from database to jsp

Shanaj
P: 51
hello

do u know how to retrive image from database and show the image in jsp page


retrive image using servlet or a java program
Jan 13 '07 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
hello

do u know how to retrive image from database and show the image in jsp page


retrive image using servlet or a java program
[PHP]
<%
try {
byte[]data =retrieve the image binary data from the database
response.setContentType("image/gif"); //This line is very important
ServletOutputStream so = response.getOutputStream();
sout.write(data);
so.flush();
so.close();
} catch (Exception e) {
e.printStackTrace();
}

%>
[/PHP]

Let me know if you get an IllegalStateException with this.
Jan 13 '07 #2

Shanaj
P: 51
[PHP]
<%
try {
byte[]data =retrieve the image binary data from the database
response.setContentType("image/gif"); //This line is very important
ServletOutputStream so = response.getOutputStream();
sout.write(data);
so.flush();
so.close();
} catch (Exception e) {
e.printStackTrace();
}

%>
[/PHP]

Let me know if you get an IllegalStateException with this.


Is it possible to add html code if I add this
Jan 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.