• 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

Javascript Object in HttpSession

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"visamal",
Please check your private messages.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Viswanathasivam",
Please check your private messages, again.
 
Viswa Ambal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic