1. 怎么在多个JSP页面之间进行参数传递?需要使用JSP的内置作用域对象session。利用它的两个方法setAttribute(),getAttribute()
2. 下面的这个实例实现了把第一个JSP页面的参数传递给第三个页面的功能
3. 代码如下:1.jsp
<html>
<form method=get action=2.jsp>
what's your name<input type=text name=username>
<input type=submit value=submit>
</form>
</html>
4. 2.jsp
<html>
<form method=post action="3.jsp?pass=11">
<%
String name=request.getParameter("username");
session.setAttribute("username",name);
%>
Your name is:<%=request.getParameter("username")%>
<br>what's your hobby<input type=text name=hobby>
<input type=submit value=submit>
</form>
</html>
5. 3.jsp
<html>
your name is:<%=session.getAttribute("username")%>
<br>
your hobby is:<%=request.getParameter("hobby")%>
<br>
your password is:<%=request.getParameter("pass")%>
<br>
</form>
</html>
本文地址:http://com.8s8s.com/it/it15872.htm