| Author |
how can i display an image on browser
|
ramesh kothakonda
Ranch Hand
Joined: Feb 14, 2006
Posts: 40
|
|
hi java ranchers how can i display an image on browser here i am i am getting image name from date base table. and all images are kept in c:\images directory . At the time of string concatination I am getting syntax error and i tried so many ways but i did not get . <html:image src="c:\\images/"+'<%= rooms.getThumbNail()%>'> If you give an answer i will be thank full to you thanking you, k.ramesh
|
The object oriented way of becoming "RICH" is by INHERITANCE<br />Whoever said money can't buy happiness, didn't know where to shop.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
|
|
Ramesh, There is more than just a syntax error to watch out for here. The src attribute will be used by the browser to request the actual image. however, the browser cannot access the images directory on your server. It requires a URL beginning with http. This means you need to place the images on a webserver or as part of your web application. If the images were on the user's machine, the URL would begin with file://c.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
I would look at writing a download Action class that extends org.apache.struts.actions.DownloadAction. By doing this, you can create a class that will either get the data directly from the database and output it to the output stream, or get the data from a file outside your web context and output it to the output stream. Once you've done this, you can simply code: <html:img action="/myDownloadAction" />
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: how can i display an image on browser
|
|
|