I need to use hidden variables in my JSP for session tracking. This is the code:
<input type="hidden" name="REQ_TOKEN" value="<%=session.getAttribute("SESN_TOKEN").toString()%>" />
I am using this to compare the request token with session token, so only when both are equal I will evaluate that request otherwise I will throw an error.
Now the problem is, when I place this code inside <form></form>
tags, it is working fine. Unfortunately there are some JSPs in my application where we dont have <form>
tag (I know that sounds weird!). Where can I place my code so that it will work?
Can't i use Hidden variables without <form>
tag?