如何访问Session变量并使用JSP在javascript中设置它们 [英] How can I access Session variables and set them in javascript with JSP
本文介绍了如何访问Session变量并使用JSP在javascript中设置它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在jsp页面中有一个值,即
session.setAttribute(sValTest,Test);
那里当我点击我必须更改的值时是按钮
即在测试地点值我必须设置JAVA并且每当我刷新同一页面时sValTest的新价值现在是JAVA而不是测试但显示测试。
请帮助我
使用JAVASCRIPT& JSP
谢谢
I have one value in jsp page i.e.
session.setAttribute("sValTest", "Test");
and there is button when I click on that the value I have to change
i.e. In the Place of Test value I have to set "JAVA" and whenever I refresh the same page New Value of sValTest is now "JAVA" NOT "Test" but it Display "Test".
please help me
using JAVASCRIPT & JSP
Thank you
推荐答案
试试这个
window.localStorage.setItem(sValTest)
try this
window.localStorage.setItem(sValTest)
javascript函数启动的地方你可以写这个或者把代码放入if条件和检查sValTest是JAVA还是TEST
where the javascript function starts you can write this or else put the code in if condition and check sValTest whether it is JAVA OR TEST
这篇关于如何访问Session变量并使用JSP在javascript中设置它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文