Passing an image to jsp
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mike_Cos
Posted On:   Saturday, December 7, 2002 10:49 AM

Hello, I'm forwarding a bean that is a String of the url that points to an image file. The following code shows my jsp. The image is diplayed fine in IE, but in Netscape 6 the image will not appear....does anyone know why? ‹%@ page language="java" %› ‹%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %› ‹%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %› ‹%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %› ‹%@ page import="java.lang.String" %› ‹%@ page import="com.earthquake.common.Constants" %› ‹jsp:useBean id="jpegPlot" scope="session" type="j   More>>

Hello,

I'm forwarding a bean that is a String of the url that points to an image file. The following code shows my jsp. The image is diplayed fine in IE, but in Netscape 6 the image will not appear....does anyone know why?

			
‹%@ page language="java" %›
‹%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %›
‹%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %›
‹%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %›
‹%@ page import="java.lang.String" %›
‹%@ page import="com.earthquake.common.Constants" %›
‹jsp:useBean id="jpegPlot" scope="session" type="java.lang.String" /›
‹html:html locale="true"›
‹head›
‹html:base/›
‹/head›
‹body bgcolor="333333" link="white" alink="white" vlink="white"›
‹font face="arial" color="black"›
‹font color="white"›
‹html:errors/›
‹/font›
‹p align="center"›

‹img name="pict" src= <%=jpegPlot%> height="500" width="500"›

‹/p›
‹/body›
‹/html:html›


Thanks,
Mike    <<Less

Re: Passing an image to jsp

Posted By:   Erik_Hatcher  
Posted On:   Saturday, December 7, 2002 06:07 PM

You're trying to serve the image up through the filesystem rather than HTTP, right?

I just fought with this same issue for a small demo app and found it better to simply write a servlet to serve the files up.

Try opening the file through both browsers directly and looking at the difference in the URL's shown and that will show you why it doesn't work. Frustrating... but serving from the local filesystem isn't really scalable or very useful for anything more than an example.
About | Sitemap | Contact