*
The moose likes Struts and the fly likes Help needed in displaying an Image in the Struts 1.1 View Layer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help needed in displaying an Image in the Struts 1.1 View Layer" Watch "Help needed in displaying an Image in the Struts 1.1 View Layer" New topic
Author

Help needed in displaying an Image in the Struts 1.1 View Layer

Sakthi Ramasamy
Greenhorn

Joined: Jun 02, 2008
Posts: 17
Hi,

We are developing a GUI in JSP, using Struts 1.1 version, which has the following requirement.
Req 1. (Screen 1): Upload the Image from the GUI and store it in the database and add an description for it.
Req 2. (Screen 2): A Combo box should populate the Image Description.
Req 3. (Screen 2): On selection of the Image Description (as described above), the corresponding image should be retrieved from the database and populated in the GUI.

Completed Steps: Req 1 and Req 2.

Help Needed Area: Req 3

Req 3 needs some expert advice on how to do it. we were thinking of using the plain Ajax to enrich the user experience but we were struggling to display the image, since we were running short of time and we were lacking the expertise in it.

I profoundly thank you, if you could share any ideas / help to proceed forward.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Clue #1: How does one normally show images in an HTML page?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sakthi Ramasamy
Greenhorn

Joined: Jun 02, 2008
Posts: 17
We use the <img src =""> for the HTML page, but the challenge encountered is that the image is being retrieved as a BLOB Object (Stream). The HTML img tag expects an image from the filesystem and not a stream., I believe.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Sakthi Ramasamy wrote:We use the for the HTML page, but the challenge encountered is that the image is being retrieved as a BLOB Object (Stream).

The stream should not be sent to the JSP -- it's not useful there.

The HTML img tag expects an image from the filesystem ...

Incorrect. It expects image data from whatever URL is specified as the value of src. Whether that comes from a file or not is irrelevant. It can, for example, be served as a servlet which reads a blob from the database.
 
 
subject: Help needed in displaying an Image in the Struts 1.1 View Layer
 
Similar Threads
Problem encountered in JSF Frame work
How to display first 2 lines of data on jsp
Can you Help to make the make application capabile of saving Image in Database using JDBC?
What To Download To Use The Struts 1.1?
Migration from Windows C based GUI to JavaFX