当前位置: 技术问答>java相关
jsp 基本问题
来源: 互联网 发布时间:2017-03-16
本文导语: String name = 1 String user = 2 String number = 3 String soft = 4 Vector page = new Vector(); page.addElement(name); page.addElement(number); page.addElement(user); page.addElement(soft); session.setAttribute("page",page); respon...
String name = 1
String user = 2
String number = 3
String soft = 4
Vector page = new Vector();
page.addElement(name);
page.addElement(number);
page.addElement(user);
page.addElement(soft);
session.setAttribute("page",page);
response.sendRedirect("1.jsp");
我怎么才能在1.jsp中把 几个变量取出来.
还有能不能详细介绍一下Vector的用法
String user = 2
String number = 3
String soft = 4
Vector page = new Vector();
page.addElement(name);
page.addElement(number);
page.addElement(user);
page.addElement(soft);
session.setAttribute("page",page);
response.sendRedirect("1.jsp");
我怎么才能在1.jsp中把 几个变量取出来.
还有能不能详细介绍一下Vector的用法
|
Vector xx = new Vector();
if (session.getAttribute("page")!=null) {
xx = (Vector)session.getAttribute("page");
}
// 得到各变量
if (xx.size()>0) {
String name = (String)xx.elementAt(0);
}
if (xx.size()>1) {
String user = (String)xx.elementAt(1);
}
.
.
.
}
if (session.getAttribute("page")!=null) {
xx = (Vector)session.getAttribute("page");
}
// 得到各变量
if (xx.size()>0) {
String name = (String)xx.elementAt(0);
}
if (xx.size()>1) {
String user = (String)xx.elementAt(1);
}
.
.
.
}
|
http://expert.csdn.net/Expert/topic/1168/1168302.xml?temp=.3938715