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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -