• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javascript Object in HttpSession

 
Viswa Ambal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to store javascript object in HttpSession (in JSP)?
If possible please help me with sample code.
If not please suggest for alteration.

Thanks in advance.

-Visamal
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its not possible.Javascript work on the client side and we can only store java objects available in the JVM on which the server is running in HTTPSession .
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"visamal",
Please check your private messages.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by visamal:
If not please suggest for alteration.


Nobody will be able to suggest an alternative unless you tell us what you're trying to achieve.
 
Viswa Ambal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope is clear with with Query.
Again....
I'm trying to store the Javascript Object to HttpSession of JSP/Servlet.
Will it be possible to store a Javascript Object in HttpSession?
If it is not possible , any other way to retain the Javascript Object?

Hope is clear now

-Visamal
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Viswanathasivam:

If it is not possible , any other way to retain the Javascript Object?


Javascript objects are present on the client side hence cannot be stored on the server side HTTPSession.

Though you might store it in client side cache which would allow the object to remain intact even after a server hit.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Viswanathasivam",
Please check your private messages, again.
 
Viswa Ambal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Work around :
we can use Dojo tool kit for storing javascript object.

Disadv :
Each jsp page load will load the dojo library create performance issue.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the server side we can store the text which when loaded in a browser creates a JavaScript object. This includes both the code and values for variables, but it is still text.

From the client side we can have a JavaScript object send to the server a complete set of the current state of its variables in the form of text which can be stored on the server side.

Is that what you are trying to achieve?

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!