Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 2nd, 2008, 11:44 PM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display pictures on JSP page?

HI all. pls help me. I already upload image into blob field Oracle. Now I want to display picture on JSP page from oracle db blob field.
1. how i select pic from blob
2. how to display pic on jsp
 how I decide this problem?

Reply With Quote
  #2 (permalink)  
Old November 3rd, 2008, 09:02 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

It doesn't matter whether the page you display the picture in is a JSP page or ordinary HTML page.

The "trick" is to simply use an HTML image control but to specify a JSP-based URL.

That is, something like:
Code:
    <img src="http://www.yoursite.com/getImageFromDB.jsp?id=778" />
There are MANY possible variations on the form of the URL. You might use URL rewrites, for example, to have a "pretty" looking url such as:
Code:
    <img src="http://www.yoursite.com/image/778" />
where in actuality, behind the scenes, that is transformed into the first URL I showed.

So then what you have to do is to write JSP code to retrieve the BLOB from the DB and send it as a binary stream to the browser. And there are many ways to do that. I think you could google for solutions a lot faster than I could write one for you. You shouldn't need more than about 20 or 30 lines of code to do this, by the way.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display pictures on JSP page? coitri JSP Basics 19 November 24th, 2008 06:22 AM
JSP page not display data coming from socket ashvinm JSP Basics 0 February 20th, 2008 02:10 AM
Display many pictures NBM Java GUI 0 September 3rd, 2006 06:54 AM
How to display Vietnamese Unicode on JSP page? minhpx JSP Basics 4 May 18th, 2006 11:16 PM



All times are GMT -4. The time now is 04:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.