日期:2014-05-20  浏览次数:20754 次

jsp重定向,用session怎么传值??谢谢
这是c.jsp里的内容
<%
session.setAttribute( "data ",   "request ");
      response.sendRedirect(session.getContextPath()   +  

"/grammar/v.jsp ");
%>

这是v.jsp里的内容
<h1> view: <%=   session.getAttribute( "data ")%> </h1>


我知道写的不对,怎么改才可以传data的值呢?


------解决方案--------------------
第一张网页
<%
session.setAttribute( "name ", "name ");
response.sendRedirect( "b.jsp ");
%>
第二张网页
<%=(String)session.getAttribute( "name ")%>
------解决方案--------------------
------------------simp.jsp------------------------
<%@ page contentType= "text/html;charset=gb2312 " language= "java "%>
<jsp:include page= "two.jsp " flush= "true ">
<jsp:param name= "songfuqang " value= "在另一张网页使用该值 "/>
</jsp:include>

-------------------two.jsp---------------------------
<%@ page contentType= "text/html;charset=gb2312 " language= "java "%>

<%=request.getParameter( "songfuqiang ")%>
测试通过!