High performance file creation

R

Rui Pacheco

Hi everyone

I have a servlet that queries a database, processes the ResultSet,
turns it into a n String[][] and sends it by Serialization into an
applet that contains basically a JTable to display the contents to the
user.
Now, somewhere in the middle of this, a StringBuffer is filled with
the contents of the String[][] so an CSV file can be created on the
server for the final user to download. The ideia is to display the
data on the applet and manipulate it on the Excel sheet.
But... the applet updates the JTable with the table faster than the
file can be written on the server, so when the link is shown on the
webpage the file hasn't been created and when the user tries to save
it, it returns an error.

Is there a way for me to create the file faster than the applet is
created?


Thank you very much
Rui Pacheco
 
A

Andrew Thompson

Please do not cross-post Rui.

....
Is there a way for me to create the file faster than the applet is
created?

An alternative is to display the _link_ only
after the file is created. eg

a) Show your applet, where the link will appear,
put a cardlayout with a blank panel.

b) Once your file is ready, change the cardlayout
to a second panel, which contains the 'download' link.

Just a thought.
 
M

Michael Borgwardt

Rui said:
But... the applet updates the JTable with the table faster than the
file can be written on the server, so when the link is shown on the
webpage the file hasn't been created and when the user tries to save
it, it returns an error.

Does it make sense to create a file at all? Couldn't you just create it
on-the-fly in another servlet that takes the data out of the application
context?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top