Is it possible to set/assign value in session using java script?
Basically, I have few links on my JSP page and on click of those links, I need to set a variable in session.
Is it possible to set/assign value in session using java script?
Basically, I have few links on my JSP page and on click of those links, I need to set a variable in session.
Share Improve this question asked Mar 11, 2011 at 10:31 ajmajm 13.2k59 gold badges169 silver badges241 bronze badges2 Answers
Reset to default 5session is server side concept, while javascript plays on browser
- You can either use ajax on click of those link make a request to server and pass the info. and set it to session @ server
Or
- If those links on whichuser is going to click is your server's then pass some param with it. and track it at server
The easiest approach is to use a hidden input element bound to a bean property in session scope, and put a JavaScript onclick handler in a mandlink that sets the hidden element's value before submitting the page.