calling from a jsp page

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
majalitto
Posts: 3
Joined: Tue Nov 11, 2003 6:00 pm

calling from a jsp page

Post by majalitto » Wed Nov 19, 2003 6:04 pm

I have a jsp page where I would like to include a chart. I simple called the servlet using the image source attribute and setting it to the servlet.

<img src="/MyServlet" />

The servlet creates a chart based upon session attributes that are created. When I enter the name of the servlet in the address bar, it creates the chart. The content type in the servlet is image.png.
But if I call the servlet by using the image tag it will not appear.
Can somebody tell me what I'm doing wrong.

patrickherber
Posts: 8
Joined: Mon Jul 28, 2003 5:07 pm

Post by patrickherber » Sat Nov 29, 2003 6:30 pm

Did you receive an answer or find a solution?
Actually what you do looks ok. (I do quite the same (only using Struts actions) and I have no problems)
If you want you can send me your servlet and I have a look at the code.
Regards
Patrick (patrick.herber@ticino.com)

tbardzil

Post by tbardzil » Sun Nov 30, 2003 10:31 pm

try something like

<img src="/MyServlet/chart.png"/>

I believe IE has problems unless the name of the image is a recognizable image type.

Tim

Guest

Post by Guest » Mon Dec 01, 2003 4:12 pm

*checks* you meant "image/png" or "image.png" ?

it works fine on my system, but then again i dont use IE.

delboy

Post by delboy » Wed Dec 03, 2003 2:49 pm

if i use

<img src ="MyServlet">

how can i also pass parameters back to the servlet to determine which image i need to be created??

bmoody
Posts: 9
Joined: Tue Nov 25, 2003 7:02 pm

Post by bmoody » Wed Dec 03, 2003 8:16 pm

try
<img src ="MyServlet?imgType=chart1">

then in the servlet
String imgType = request.getParameter("imgType");

if(imgType.equals("chart1"))
{....

Locked