javascript - JSP - session is undefined? -
i'm trying pass variable between 2 jsp files, when come use them, error saying 'session undefined'
i'm using following:
jsp1: //following function called on button press function clickandclose() { session.setattribute("test", "some value here"); window.close(); } jsp2: <!doctype html> <html> <body> show selected rs number <script language="javascript"> string number = session.getattribute("test"); session.removeattribute("test"); document.write(number); </script> </body> </html>
the fact error on session.setattribute confuses me, thought session implicit object (included?) ?
note: i'm getting error on session.setattribute("test", "some value");
, saying session undefined, not string text = session.getattribute("test");
you trying use session
inside <script language="javascript">
tag, not available there. use inside scriptlet
or jstl
tags.
javascript executed in client side, whereas jsp implicit objects available , executed in server side
Comments
Post a Comment