LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1840|回复: 5

session.setAttribute如何存放String之外的数据[解决]

[复制链接]
发表于 2005-4-19 20:14:29 | 显示全部楼层 |阅读模式
按照文档上说的,似乎可以存放任意的东西,可是我只写了这么一个东东编译就无法通过

  1. <html>
  2. <body>
  3. <%
  4. request.getSession(true);
  5. session.setAttribute("currid",0);
  6. response.sendRedirect("showmsg.jsp");
  7. %>
  8. </body>
复制代码


地5行换成session.setAttribute("currid","0");就可以通过。
 楼主| 发表于 2005-4-19 21:13:03 | 显示全部楼层
据说在Resin上这样的东东就能编译,奇怪了
回复 支持 反对

使用道具 举报

发表于 2005-4-19 23:21:01 | 显示全部楼层
呵呵,sesion存放的是对象,
session.setAttribute("currid",new Integer(0));
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-20 09:35:19 | 显示全部楼层
阿,明白了,多谢哈
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-20 10:06:17 | 显示全部楼层
很奇怪阿,还是不行

  1. org.apache.jasper.JasperException: Unable to compile class for JSP

  2. An error occurred at line: 3 in the jsp file: /index.jsp
  3. Generated servlet error:
  4. /opt/tomcat5/work/Catalina/localhost/myweb/org/apache/jsp/index_jsp.java:47: cannot resolve symbol
  5. symbol  : class integer
  6. location: class org.apache.jsp.index_jsp
  7. session.setAttribute("currid",new integer(0));
  8.                                 ^
复制代码
回复 支持 反对

使用道具 举报

发表于 2006-12-29 07:55:00 | 显示全部楼层
integer要大写
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表