File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

client could not get update session data

 
david arnold
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to retrieve data and update a web page every few seconds. I had a problem to get updated session data from client side. I use a ajax call (in jsp file) to send request to struts action, which perform the request and saved java object data in the session. Then the jsp file (which sent request) use javascript to create a table dynamically, but the problem is that the javascript always get old session data, unless the jsp page is refresh, which is not wanted.

I have cleared the catch both in jsp file and in server side, and wondering what is the reason of the problem?

Thanks for the help!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using Ajax the page doesn't access the server except though the Ajax request, so how could it possibly know anything about session data?

The only new data that the page gets is from the Ajax response.
 
david arnold
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh i see. Thank you for the clarification. I am looking at json (did not use it before), I am thinking to return json object (convert java object to json obj) to client side and use javascript to parse it. Is there any other better solution?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better in what way?
 
david arnold
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean in other way like using xml instead of json, I think they are not big difference between them, just the data format difference.

I got another problem, in struts 1, I usually handle the request and forward reponse to a jsp file , as result jsp file got a form. Now I use ajax to call the action, the action handle request and convert java object to json ( ), how could I get that from jsp file? As I know, strus only forward the action form to jsp file.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic