Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Timed Java Script Request & Struts?

nuwan chandrasoma

2007-01-19

Replies:

Hi,

I will give a answer for your periodic request call.
you have to use the java script setTimeout() function and do the call
periodically.

eg:-


<%@(protected)"
  pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>


<script type="text/javascript">

function updateOrderList(){
  // write you XHP call here..

  setTimeout('updateOrderList()',5000);
}

</script>

<script>
  setTimeout('updateOrderList()',5000);
</script>
</body>
</html>

when the pages loads, the scripts tag in the bottom of the pages fires the
setTimeout method which would call the updateOrderList() function in 5000
mili seconds, and in the function you do your ajax call, after this also you
call the you call the same method.. this would spawn a never ending loop
until this page is goes out of the browser window.

Thanks,

Nuwan.




----- Original Message -----
From: "Peter Neu" <peter.neu@(protected)>
To: "'Struts Users Mailing List'" <user@(protected)>
Sent: Friday, January 19, 2007 2:09 PM
Subject: Timed Java Script Request & Struts?


> Hello,
>
>
>
> in one of my endless attempts to fight the evil browser backward button
> mechanism I was thinging about this:
>
>
>
> Can I make a periodic java script (ajax) request to determine when a user
> hit the evil button and tries to work
>
> a page that is not current anymore? Say the user hit the back button and
> now
> resides on the "wrong" page
>
> I make a hidden ajax request and determine he is in the wrong pace. Then I
> give him a notice and send him back
>
> to the right place.
>
>
>
> Is this possible? How would I make the periodic request?
>
>
>
> Cheers,
>
> Pete
>
>
>
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.