1.通过js
在脚本中通过localStorage传值
代码如下:
a.jsp
传递
<script>
function show(event)
{
var x=event.target;
var y=x.textContent;
localStorage.hel=y;
localStorage.hel2=x.id;
}
function show1(event)
{
var x=event.target;
localStorage.hel3=x.getAttribute("src");
}
</script>
b.jsp
获取
<script>
function Get(event)
{
var a=localStorage.hel;
}
</script>
2.通过链接
a.jsp
<a href="b.jsp?name=要传的值"></a>
b.jsp
获取值
<% String str=request.getParameter(“name”);%>
3.通过httpsession
这个一般都熟,就不讲解了