The Jsp Calls A PHP which in turn resizes a phtograph and writes it to disk,the jsp writes out an img tag referring to that photo written on to disk,now sometimes the image is not displayed and a cross is displayed against it,which shows that before the PHP had written the file to disk,the jsp wrote the img tag and the browser rendered it.I want to wait the jsp for 2-3 seconds before it writes out the tag,although it wont completely remove the possibility of the image not loading,but it will surely minimize it,here is the code
[ June 21, 2007: Message edited by: anand phulwani ]
Thanks and Regards, Anand
SCJP 5.0 310-055 73%, SCWCD 1.4 310-081 78%, IBM DB2 9 Fundamentals 000-730 62%
Java Advanced Imaging (JAI) makes it pretty easy to resize images from within your java code. Going this route would eliminate the need for JSP altogether.
Have your PHP script return something. Then use UrlConnection's getContent or getInputStream method to read the response from the PHP call. This will force your JSP page to wait until the PHP page has finished processing before moving to the next line.
Just having your JSP sleep for an arbitrary number of seconds, as you've said, will either force the user to wait longer than necessary or, worse, if the image takes longer, still leave you with the same problem you have now.
anand i think JAI solution should work... but its not.. then why don't you use java script, to load the image after complete loading of entire file.. and mean while popup a nice processing or in prorcess layer.. to facilitate users.. if image is so critical..
i know JS solutions should be used as last solution.. did you try Thread.sleep(). isn't it working..?
Architect<br />SCJP<br />SCWCD<br />IBM-486
posted 13 years ago
Originally posted by Faisal Ahmed Siddiqui: did you try Thread.sleep(). isn't it working..?
As already said, "Just having your JSP sleep for an arbitrary number of seconds" doesn't sound like a rational thing to do.