?
Solved

How to Call a JSP in between from Struts Action Class while processing a text file?

Posted on 2006-05-24
3
Medium Priority
?
196 Views
Last Modified: 2010-04-01
Hi All,


I'm processing a text file i.e in the struts action class.. reading each line of text file and tokenizing it and consturcting an value object
and passing it to an EJB. If the text file contains 1500 records(lines) and if it is takinig more
than 5000 milli seconds to process the 1500 lines, then instead of making wait the user, i
would like to send a confirmation number, by which he can check the status afterwards.
 

My concern is if the processing time is more than 5000 ms , then i need to call a JSP from my
struts action class and will display the confirmation number to the user, but in the background
the processing should be going on till all the lines in the file gets completed.


How can i call a JSP from Action class in between while the text file is  processing .

Thanks,
Ram
0
Comment
Question by:ramsin112400
1 Comment
 
LVL 4

Accepted Solution

by:
evnafets earned 160 total points
ID: 16755571
How about starting up a new thread
Make this processing of records a seperate class
Have it implement "runnable"

ie
public class FileProcessor implements Runnable{
  public void run(){
    // code to process one file
  }
}

then in your Action you do something like this:

Thread processThread = new Thread(new FileProcessor(fileToProcess));
processThread.start();
return mapping.findForward("started");

Starting a different thread lets you pass off the work somewhere else, and return control to struts, where it can send the confirmation page.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question