• 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 to display image and text feilds from database in a same jsp using struts2

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to struts2.
my job is to display the following information to the user
1.photo
2.personal information like name,DOB,address etc

All this information is available in the database (mysql)..
i have to retrieve and show them to the user.

Since both the data are of different types(text and image) iam unable to display them to the user in same page..can any one suggest me the way of doing this.
any code snippet will be helpful.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch. Web pages load images by making an additional request to the server for each IMG tag. You can create an action that accepts whatever information you need to identify the image in the database and return the binary image. On your user detail JSP page, you would build the IMG tag with those arguments. When the page is rendered by the browser, it will call your image action and display whatever it returns. Of course, it would be a good idea to gracefully handle images that can't be retrieved with a reasonable default and secure your images against unauthorized users.
 
prachi barahate
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks joe for your response.
I got your point.
Please help me how to pass imageidfrom action class to image attribute.


 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
something like:

where getImageFromDBAction is the name configured in struts.xml for your image retrieval action and imageId is a property in the user detail action.
 
prachi barahate
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your great help.
I achieved
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic