alskdj80
asked on
Servlet waiting page, processes, then redirecting to completed page
i have a form on a jsp (lets call it formjsp.jsp)... this form will call a servlet... the problem is that this servlet will take a long time to process... therefore, i want some indicator (something like a window, doesnt have to be a popup, it can just go to that new page called waiting.jsp) that tells the user to wait and not touch anything...
however, heres the tricky part, after the servlet is finished, i need it to redirect to the completed page (call it complete.jsp)... so if waiting.jsp was a popup, i'd like to close the popup... if waiting.jsp was a page on the original browser window, i want it to redirect to complete.jsp... does that make sense?
i have tried to do both page calls within the servlet, so i would have:
//SERVLET
public void doPost ... {
RequestDispatcher dispatcher = getServletContext().getReq uestDispat cher("wait ing.jsp");
dispatcher.include(request , response);
//do long processing
RequestDispatcher dispatcher = getServletContext().getReq uestDispat cher("comp lete.jsp") ;
dispatcher.forward(request , response);
//btw, i have also tried >> response.sendRedirect("com plete.jsp" ); but neither of them work
}
another way ive thought of has been to forward directly to waiting.jsp and then make it forward a hidden submission to the servlet, which then redirects to complete.jsp when it is done... however, im not quite sure how to do this hidden submission (is there any other way besides using http-equiv?) and i also do not know how to forward the POST parameters.
if anyone has any elegant ways of accomplishing what i want, please suggest them
btw, i really do not wish to use javascript
thanks so much!
however, heres the tricky part, after the servlet is finished, i need it to redirect to the completed page (call it complete.jsp)... so if waiting.jsp was a popup, i'd like to close the popup... if waiting.jsp was a page on the original browser window, i want it to redirect to complete.jsp... does that make sense?
i have tried to do both page calls within the servlet, so i would have:
//SERVLET
public void doPost ... {
RequestDispatcher dispatcher = getServletContext().getReq
dispatcher.include(request
//do long processing
RequestDispatcher dispatcher = getServletContext().getReq
dispatcher.forward(request
//btw, i have also tried >> response.sendRedirect("com
}
another way ive thought of has been to forward directly to waiting.jsp and then make it forward a hidden submission to the servlet, which then redirects to complete.jsp when it is done... however, im not quite sure how to do this hidden submission (is there any other way besides using http-equiv?) and i also do not know how to forward the POST parameters.
if anyone has any elegant ways of accomplishing what i want, please suggest them
btw, i really do not wish to use javascript
thanks so much!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why don't you want to use javascript? i think it would impossible to do what you want without using some kind of client-side scripting.
the way i would do it
1. call the servlet.use javascript to change the butto text corrosponding to ur function (for eg smthn like uploading or please wait)
2. let the servlet complete operation
3. redirect to the required page
u can also disable the submit button after submission so the user doesnt submit twice
cheers,
1. call the servlet.use javascript to change the butto text corrosponding to ur function (for eg smthn like uploading or please wait)
2. let the servlet complete operation
3. redirect to the required page
u can also disable the submit button after submission so the user doesnt submit twice
cheers,
ASKER
the reason i dont like javascript is because the browser support is tricky... just my personal preference, =)