Ticket #18 (closed Bug: fixed)
wap版产品库header.jspf报session变量重复声明
| Reported by: | huangxianduan | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | 产品库 | Version: | |
| Keywords: | Cc: | ||
| Due Date: |
Description
jsp页面报session变量与内置对象session冲突。
原因:<%@page session="true"%>,这样在编译时会自动生成javax.servlet.http.HttpSession? session = request.getSession(true);这样的代码,在代码中又有HttpSession session = request.getSession(true);这样的变量定义,因此就报变量重复声明了。
还有一点需要注意的,如果这个页面还include了其他jsp,而且<%@page session="false"%>,这样就不会自动生成session了,就可以自己手动再定义session变量,正是因为这个原因导致有的页面报错有的页面就正常。
解决方案:很多页面都include了header.jspf的同时还有其他的页面,但只有header.jspf用到session,所以就把page的session设为false了,这样就可以HttpSession session = request.getSession(true);来使用session了。
Change History
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)