This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Asynchronous response handling. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Asynchronous response handling." Watch "Asynchronous response handling." New topic
Author

Asynchronous response handling.

Nitish Kumar Singh
Greenhorn

Joined: Aug 16, 2013
Posts: 5
Can anyone help me, with this scenario...

There are three submit buttons: button1, button2, button3 in a home.jsp page. When user clicks on button1 , request is send to servlet1 which calls a java code to copy a file (30 mb) from one location to another. Similarly, button2 calls servlet2 which does same thing and button3 calls servlet 3 which does same thing. So there are three different file which are being copied simultaneoulsy. Now as they are being copied in background, user moves to home.jsp page. This home.jsp page has two parts, one contains button1, button2 and button3 and second part is blank. When servlet1 starts the first copying process, text should be displayed in home.jsp that file is getting copied, similarly for servlet2 and servlet3. Once file is being copied, info should change to, "File has been copied successfully". If any error occurs, that should be displayed too.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

Nitish,
Welcome to CodeRanch!

It sounds like you want to use AJAX. Each process would put an attribute in the session with the status ("copying file 1", "finishing copying file 1", etc). Then the JSP/HTML page could poll the server for that status and display it to the user.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Nitish Kumar Singh
Greenhorn

Joined: Aug 16, 2013
Posts: 5
Thanks, but this is not what I meant.
Suppose there is another jsp page , say info.jsp. This jsp page records the info for all the process going at back end. At any time of day if I click and open this page, then i should get the info of process which failed which succeeded.

example.
info.jsp

Process 1 - successfully deployed
process 2 - error occured
process 3 - Deploying.
Process 4 - Deploying.
Process 5 - successfully deployed

I will open this page after long time, till then all info should be recorded. Sessions i cant use because there are 1000 such processes.
Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33

you will definitely need to store the information about the processes in the Database.....

SCJP
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Asynchronous response handling.
 
Similar Threads
Servlet Performance ....
Please help me
Screen rotated between portrait and landscape on the fly
requestdispatch - servlet to servlet in iplanet( anyone plzzzzzzz!!!!)
problem in deleting data