inzaghi
asked on
JSP Processing
I have a situation where by I want to display an image to the user such as a an animated image eg clock whilst the page is doing some processing ie simular to websites when you are searching for flights and hotels.
Once the search is complete I want to redirect the user to another page.
How can this be done using html/javascript in a Java Server Page
Once the search is complete I want to redirect the user to another page.
How can this be done using html/javascript in a Java Server Page
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You coudl use an applet
see this script
http://bokehman.com/loading
http://bokehman.com/loading
ASKER
Suppose I dont want the form to submit to another page but whilst the search results are being retrieved in the jsp, how can the animated gif be displayed whilst the form is being rendered.
ASKER
Come on experts need your help big time.
ASKER
<form action="processSearch.jsp" onsubmit="doSearch()">
Also in your html, you want to add your canimated clock, but hide it using stylesheets:
<div style="visibility:hidden;" id="clock"><img src="..."></div>
In your javascript fiunction, set the clock as visible via the following:
document.getElementById("c lock").sty le.visibil ity = "visible";
In the above case I will not be submitting a form but the jsp will be invoked which will do the processing.
How can I display the animated gif uptill the point page is rendered.
e.g assuming this is my jsp
display the gif
do business logic
business logic completed
render form
Also in your html, you want to add your canimated clock, but hide it using stylesheets:
<div style="visibility:hidden;"
In your javascript fiunction, set the clock as visible via the following:
document.getElementById("c
In the above case I will not be submitting a form but the jsp will be invoked which will do the processing.
How can I display the animated gif uptill the point page is rendered.
e.g assuming this is my jsp
display the gif
do business logic
business logic completed
render form
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes if you have to do asynchronous kind of processing in a web-app, the best option is probably to use Ajax. That's also what Gmail and Orkut use.
ASKER
cant I use the onload method of the form?
onload only works in the body tag, since its the page that loads as opposed to the form itself.
colr__
colr__
>> cant I use the onload method of the form?
It would be called only once, when the form loads. From the sounds of your requirement, you probably need to run some logic multiple times even after form-load.
It would be called only once, when the form loads. From the sounds of your requirement, you probably need to run some logic multiple times even after form-load.
ASKER
I only want to display the gif uptil the point the jsp page starts to render its display values to the user
ASKER
similar to any sites such as lastminute.com
You can do this via the method Ive shown you above, but changng it slightly.
Whenever the first result is created and sent to the browser, just before this, set the visibility of the clock to be hidden (as per my post above). This will hide the clock and show the results as they are generated.
colr__
Whenever the first result is created and sent to the browser, just before this, set the visibility of the clock to be hidden (as per my post above). This will hide the clock and show the results as they are generated.
colr__
ASKER
I need to do the following:
display a temporary title
display the processing gif
do the business logic
redirect to the results page
I was thinking of doing this in the JSP
<%
display a title (inactive field)
display the gif
flush the buffer, send the response to the client
do the business logic
redirect to the results page
%>
how could I redirect to the results page, if I do a redirect It might throw an exception?
display a temporary title
display the processing gif
do the business logic
redirect to the results page
I was thinking of doing this in the JSP
<%
display a title (inactive field)
display the gif
flush the buffer, send the response to the client
do the business logic
redirect to the results page
%>
how could I redirect to the results page, if I do a redirect It might throw an exception?
display a temporary title - this wont be possioble, once an HTML title has been et, you cant change it as far as I know (Id check this with the javascript experts).
display the processing gif - create the image to display as normal, and hide it with javascript once it is to be removed, as per the above posts.
do the business logic - as normal
redirect to the results page - redirect as follows:
response.sendRedirect("res ultspage.j sp");
return;
colr__
display the processing gif - create the image to display as normal, and hide it with javascript once it is to be removed, as per the above posts.
do the business logic - as normal
redirect to the results page - redirect as follows:
response.sendRedirect("res
return;
colr__
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.