Link to home
Start Free TrialLog in
Avatar of aarschie
aarschie

asked on

Display a message when JSP is waiting for a process to be completed

How to display a message on the browser when JSP is waiting for a process to be completed.

Help urgent .....
Thanks
Arschie
ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aarschie
aarschie

ASKER

Actually I have first.jsp which calls a second.servlet to process the form fields. It takes couple of minutes to process it. I want to display a message on first.jsp once submit button is pressed to wait until the second.servlet is processed and redirects to another JSP.
use option 2 then. instead of redirect to page2.jsp, just use URL=second.servlet. e.g.
first.jsp submit to second.jsp

second.jsp:
<%
  // get necessary parameters and save then in session.
%>
<html>
<head>
<META HTTP-EQUIV=Refresh CONTENT="0; URL=servleturl">
</head>
<body>
please wait!
</body>
</html>

servlet:
get parameter form session stored by second.jsp. process and redirect to final.jsp
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you think session is burden use cookie
kennethxu,

i didn't see your code. My code is similar to yours. Sorry
Modified version of mine and  kennethxu's idea


page1.jsp

<%
   if(session.getAttribute("refresh")!=null)
   {
            //check whethere process is completed
            if(processcompleted)
            {
              session.removeAttribute("refresh");
            }
%>
<html>
<head>
<META HTTP-EQUIV=Refresh CONTENT="0; URL=page1.jsp">
</head>
<body>
please wait!
</body>
</html>
<%
   }
   else
   {
%>
            <html>
<!--             Your submission code to page2.jsp -->
            </html>
<%

   }

%>


page2.jsp

<%
   //process for your submission code
   session.setAttribute("refresh","true");
   response.sendredirect("page1.jsp");
%>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't want any points here It really does not matter but I believe that the answer I posted is as valid as any of the other ones, to tell the truth is faster and easier to implement, but....

:c)

Javier
Avatar of girionis
Yes your code should work, you are right. Sorry I should have actually included you in the split. I hope a moderator will also award some points to you.
As I said Girionis I'm not interested on the points, just on giving solutions, but .... :c)

Javier