Hi all, This is a part of JSP i am developing: Based on user input the array arguments for the java class below differs.
In the above JSP file, i am calling a java class called SOEfile, which actually creates a file called "temp.html" . The java class does lot of file processing, basically it takes input as a array of text files and read each of the files and write them all together in the temp.html. After that I need to include that temp.html created by the java class in my JSP page. Only after the temp.html is written down fully , it has to be included. The problem is , the JSP shows up the temp.html with old contents in it. It doesn't show up the temp.html with the latest content, if press the submit button the first time, it shows old contents, if i keep pressing it like 3, 4 times, now since the temp.html is written with the new contents, it shows up correctly. Is there anyway to wait till the actual file is created and then only include it? I think whats happening is : the JSP calls the java class, since the java class is doing lot of file processing, the JSP includes the old temp.html instead of waiting till the file is written down correctly. Do i need to use threads here? Please let me know how to do this. Thanks, Priyha
But how to solve this? I need some way to wait and then include the file... is there any function that we can use like sleep() or something to just wait for some fixed time and then include the file? Can you any other alternative solutions? Thanks Priyha
If it's a caching problem, then there's no need to worry about waiting or any other such nonesense. Before applying a solution, it'd be best to find out what the problem actually is. Btw, since you know enough about the data to write it out to a file, why bother rather than just streaming it to the JSP output stream? bear
Are you closing the output file before trying to read from it?
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Joined: Sep 13, 2001
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com