• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how can i display an image on browser

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" />
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic