• 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

Display Image using struts2

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Struts.
I want to display image on JSP page and I am using Struts2 framework.
struts.xml file
I have uploaded the image in database.
the table is ---- filepool
- id as primary key, integer
- filename longblob data type
now i have a file imageUpload.jsp


there is one action class UploadProjectFileDB.java having attribute
private File file and its setter method
and in the execute method i have made database connection and it uploads the file to table. and return success.

my struts.xml file


now i want to display this image in the uploadDone.jsp
and i have no idea how to display this image.
In brief can you please tell me how to display an image from the database.

Thanks
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reading an image from a DB isn't a Struts question (and whether or not it's a good idea at all isn't either).

On the Struts 2 end you could either write the data back directly to the response and return a null instead of a result string, or use the built-in "stream" result type.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic