Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes taking user response in middle of server processing? 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 "taking user response in middle of server processing?" Watch "taking user response in middle of server processing?" New topic
Author

taking user response in middle of server processing?

Karan Jain
Ranch Hand

Joined: May 30, 2007
Posts: 82
Hi,
I have the following requirement:
1. Upload the file on to server using commons file upload.
2. Generate a unique key using Oracle Sequence and insert a row in the file table stating file is uploaded.
3. Save the file using the unique key as name on the server.
4. Validate the file records for format errors and if there are errors show all the errors to the user in a popup window on top of the upload page.
5. If there are no format errors, store each individual record in the database in a temp table.
6. Now confirm with the user whether he really wants to release the records. (Weird but true)
7. If user says YES then read each record from the temp table and send it to business process for data validation and store mark the record as complete and store the data in the final table.
8. If user says NO then delete all the records from the temp table and delete the file on the server.

Is there any good and robust way of achieving the functionality in point 5,6,7,8? I am using JSP, Servlets and javascript.

Any help is appreciated.

Thanks´┐Ż
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

You will not be able to do all this over the course of a single request. You'll need to use multipe trips back and forth.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Karan Jain
Ranch Hand

Joined: May 30, 2007
Posts: 82
Thanks Bear...
So shld i store the data in the session or hidden fields? Please suggest.
Sundaram Karthick
Greenhorn

Joined: Jun 26, 2007
Posts: 24
I would say hidden fields should do the work for you, there is no need for a session here. If the scope of work is going to grow, then using a industry standard framework like struts or spring would be a nice idea, but for the current scenario i think jsp and servlets should do the job for you
Hope this helps


SCJP 1.5, SCWCD 1.4, SCBCD 5
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: taking user response in middle of server processing?
 
Similar Threads
commit and rollback question
how to i tackle this problem ?
storing values from JTable
Share parts of my choice.txt with javaranchers
Performance Problem?