• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problen while Using AJAX in struts

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all ,
I am newbie to the AJAX. I got one exapmle from the net and I deployed it in struts . However it works fine only when the server starts for the first time .On revisting that page the AJAX code does not work . May I know the reson why the code is running only for the first time when the server is started.
Here is the AJAX code
function callServer() {


// Build the URL to connect to

var url = "lumpsumSimulator.do?actioncondition=FIRSTTIME";
// Open a connection to the server
xmlHttp.open("GET", url, true);

// Setup a function for the server to run when it's done
xmlHttp.onreadystatechange = updatePage;

// Send the request
xmlHttp.send(null);
}

which I am caling from this JSP code

& lt;html:text readonly="false" property="txtRetainableValue" onclik="callServer();" size="25" style="text-align=left;" maxlength="14"&& lt;/html:text& lt;
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it because it is cached on the rest of the requests. That is how GET works.

xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");

put that after the open method.

Eric
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Eric ...ir worked perfectly fine....
But I would like to know what exactly the code that you have given does. You said request encash the data ...May I know what exactly the data that gets encashed by the request ....and how axactly its creating the problem for executing the link which I have given in the code

Thanks in advance
Regards
Samir
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should explain what the header does: http://www.httpsniffer.com/http/1425.htm

Eric
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot eric for your valuable help

reply
    Bookmark Topic Watch Topic
  • New Topic