Leo,

On 16.05.2021 03:16, leo wrote:
> Hi Folks
>
> In a small scale personal project served by Tomcat I record things per 
> logged-in user. The user is
> available as an attribute to Tomcat’s session objects. In the JSP pages I 
> retrieve the session
> object *through Java* like this
>
>     <%
>         HttpSession session = request.getSession();
>         ...
>         user = (String)session.getAttribute("user");
>         ...
>     %>
>
> Then later on these pages *in the JavaScript* part I have:
>
>     <script type="text/javascript">
>         var user = "<%=user%>"
>         ...
>     </script>
>
> In the JavaScript part I then do something with the *JavaScript* variable 
> `user`.
>
> I now would like to move away from JSP to normal HTML pages (stills served by 
> Tomcat with the
> session backend)
>
> Question: Can I get the content of the session object in pure JavaScript? Can 
> I somehow configure
> Tomcat to put the session info in some page headers or similar so that 
> JavaScript can read it
> directly?

what taglib are you using or is your example purely hypothetical?

---rony



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to