jsp页面传值出现错误,不知如何解决.(急)

annel_xsx 2007-07-28 05:12:11
我在两个JSP页面之间传递参数时,用了session隐藏对象,两个JSP页面的名字分别为prg.jsp和prg.update.jsp,由于某种原因,我session传的对象是List类的对象,
我在JSP页面前面加了<%@ page session="true"%>,其部分代码如下:
prgInfo Info = new prgInfo();
Info.setPrg_num(rs.getString(1));
Info.setPrg_name(rs.getString(3));
Info.setPrg_man(rs.getString(5));
Info.setPrg_dep(rs.getInt(2));
Info.setPrg_st_date(rs.getDate(4));
index++;
list.add(Info);
session.setAttribute("LIST",list);
上为prg.jsp页面内的代码.

prgInfo Info = new prgInfo();
List list = (List) session.getAttribute("LIST");

System.out.println(Integer.parseInt(request.getParameter("INDEX")));
int index = Integer.parseInt(request.getParameter("INDEX"));
boolean count = list.isEmpty();
System.out.println(list.size()+" "+index);
prgInfo Info = (prgInfo) list.get(index);


上为prg_update.jsp页面内的代码.

prgInfo是我自己定义的一个存储信息的基类.
prg.jsp转到prg_update.jsp页面是通过一个超链接进行跳转的.

问题是:每次运行到list的接口函数时就会出现错误,prg_update.jsp 页面无法正常显示.
盼高手指点. 本人将不胜感激...

...全文
297 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
还有
prgInfo Info = (prgInfo) list.get(index);你看看上边你把index写入list了么
  • 打赏
  • 举报
回复
prg_update.jsp 页面的代码全贴上来
feihua317 2007-07-28
  • 打赏
  • 举报
回复
prg_update.jsp页面上有错误,估计是你页面中的脚本标签中的java代码写错,仔细看看错误提示信息吧,这种问题应该不难的!
lionest 2007-07-28
  • 打赏
  • 举报
回复
List 是接口
不知道LZ用多态了吗?

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧