Pædantry time again.
You don't store data in a "class", you store it in a "class instance", a/k/a an Object. Objects in a
JEE HttpSession are session-scope objects.
JavaScript runs on the client. The HttpSession object and the session scoped objects named in its Map are entirely located in the server so the only way to get their values in JavaScript is to have the JavaScript request that the server return them —
e.g., via AJAX,
Now if you want specifically to get the session property when the page is first rendered to the client, that's trivial:
Note that I've retrieved only a single property value, however.
Java Object instances are binary components with opaque internals and cannot be used on clients at all (especially since
Applets are dead now).
If you want the JavaScript equivalent of an object and some/all of its properties. you'd have to have the server return that object as a JSON string*. Meaning that the server needs to construct the JSON either manually or with the aid of a JSON library in the application.
---
* That's why they call it
Java
Script
Object
Notation.