How JSP can dynamically disply the Calling status of the server

Hi,

I have written a program which simulate a phone call where it starts to establish a call for 10 seconds with callStatus = "Calling". After 10 seconds, the call is connected and the callStatus="Connected" for about 10 seconds. After 10 seconds, the callStatus="End Call". This simulation is done by a thread without invoking any special connection. It just stays in a loop for different calling stages.

To initiate this, a main.jsp page calls to AttemptCall.java program and a thread is created to intiate the job as mentioned above. While this job is running, a callStatus.jsp page is return to the client. How can the callStatus.jsp is able to display the calling status from "Calling" to "Connected" and "Call End" . And if the Call status is ended with "Call End" , how what the callStatus.jsp automatically direct to a CallEnd.jsp page?

I have no idea, how callStatus.jsp is able to capture the call status and auto direct to CallEnd.jsp. Please Guide. Do I need to establish any special remote connections or requires JavaScript to handle this with JSP.

Thank you

[1104 byte] By [yaumeilenga] at [2007-10-3 1:22:45]
# 1

Remember this is http - a protocol where the server doesnt remember the client after having finished servicing a request. So if there is a request to the AttemptCall.java and callStatus.jsp displays a message 'Calling' and the output is flushed back to the browser, that's the end of the request. The server no longer remembers the client and therefore cannot update the client when the status changes to 'Connected' or 'Call Ended'.

You have 2 options -

1. Autorefresh the page, say every 5 seconds, maintain a handle to the AttemptCall object (in say a session) and check the status of the call every request.

2. Use a behind the screen request technology like 'AJAX' to make asynchronous calls to the server.

ram.

Madathil_Prasada at 2007-7-14 18:20:01 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...