I need to save the value of a variable in Javascript which is declared and assigned value during previous call to the function in javascript. I am both declaring and initializing the variable only once, but I need to get the value of a variable when I needed. Is there is any way to store the value of variable and retrieve it, any time as I needed??
p1.jsp
<table>
<%
for(i=0;i<g;i++){
request.getSession().setAttribute("incr",i);
%>
<tr><td><jsp:include page="/p2.jsp" /></tr></td>
<%}%>
</table>
p2.jsp
<%!int i;%>
<%
i=request.getSession().getAttribute("incr");
%>
<script type='text/javascript'>
var k<%=i%>;
function d(){
k<%=i%>=5;
}
</script>
//Here, i need to print k0,k1,.... value as i needed