JSP Problem ussing implicit object (session) in a function
- by user234666
Can the object of type HttpSession called session be accessed from a function?
In a simple jsp page I have a function(see below) defined in the header of the page, and set to an onclick handle of for a button. When I press this button, I'll never see the second alert message. If I do something in the body of the page (like Session ID: <%= session.getId() % ) I have no trouble accessing it. What newbie mistake am I making?
function doTest()
{
alert('Preforming test 122333232');
String sessionId = session.getId();
alert('After access');
if(sessionId == null)
{
alert('session id is null?');
}
Thanks