Being new here, I apologize if this is in the wrong subsection (I did see the java section, but am not sure my error lies there).

I have been assigned a project where I am to create a server that lets clients connect and run a simulation, which runs on the server and gives the output to the client. The server requires matlab and gnuplot. The ouputs consist of 6 graphs created from the output data of matlab using gnuplot.

I am using netbeans6.1's run and deploy to test (hence am using Apache Tomcat 6.0.18 )

I am using a random string generator to use as a clients session and storing it in a cookie. The graphs are created on the server using this random string as part of its name (eg. <name>Ia.png).

Thus, to load this image, I am using a javascript to fetch the cookie with the name and then I display the image using document.write("<img src=\""+FILENAME+"\"></img>");

The problem that i encounter when i run this is that the client side shows a broken link (I have checked the link path, it is correct). Now the interesting thing is this; while the client is showing this broken link, if I force an event in netbeans (like say simply ctrl+s or even switch to a different tab to see another file/output), and then ask the client to refresh, the image loads just fine?! Through this, it is confirmed that the link path is correct.

I have no idea why this is occurring or any way to solve this and my deadline approaches so I would highly appreciate it if anybody could give even the slightest insight to what/why is this happening.

Thanks

nimesh

2Jan2010 17:41

Re: Images don't load, Help please..

In the below code, why are you using "\" after the filename?
document.write("<img src=\""+FILENAME+"\"></img>");

Check the output from the clients side, I mean check the HTML using view-> source from the browser after the page gets loaded. Check if the html appears correctly.

I think you are not getting the image due to the absence of the slash.

isis13

5Jan2010 00:37

Re: Images don't load, Help please..

I tried making it a function in the header and use <body onLoad=function_name()>
and also tried the slash venami mentioned, but neither seemed to solve the problem..

The funny part is, that though this gives a broken link (and 404 if i right click and select 'view image'), if i make anything event in netbeans (the ide hosting this code) like change some tab or something like that and then refresh the page, the image appears. This leads me to believe that the path at least is correct since nothing happens to the path. I have also verified that the images do get created in my content folder.

isis13

5Jan2010 01:03

Re: Images don't load, Help please..

Edit:
I tried running tomcat completely independently of netbeans and the problem still persists, and this time, i cannot click anywhere (like changing a tab in the netbeans ide) so that the image loads.

shabbir

5Jan2010 08:44

Re: Images don't load, Help please..

The problem is not with your server but looks like you have url where there is no image file