wired_up
asked on
Accessing a session variable in javascript
I am using java servlets to create the main body of a html page, in this session variables are set for login information:
HttpSession session = request.getSession(true);
session.putValue("userCode ", lsUserCode);
session.putValue("password ", password);
response.sendRedirect("/in dex_main.h tml");
Then later on one of the i want to check if the user's session is still active, i want to do with within the javascript, can i do this?
-i have been doing :
var userCode = session("userCode");
but the javascript dosn't seen to reconise the session variable, i get the error message - "object expected".
Any help would be appreciated.
Thanks
:-)
HttpSession session = request.getSession(true);
session.putValue("userCode
session.putValue("password
response.sendRedirect("/in
Then later on one of the i want to check if the user's session is still active, i want to do with within the javascript, can i do this?
-i have been doing :
var userCode = session("userCode");
but the javascript dosn't seen to reconise the session variable, i get the error message - "object expected".
Any help would be appreciated.
Thanks
:-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also the page you want to create must be a jsp page, not an html
var userCode = <%=session("userCode")%>