当前位置: 代码迷 >> Java Web开发 >> jsp中字符串赋值的异常?救!
  详细解决方案

jsp中字符串赋值的异常?救!

热度:108   发布时间:2016-04-17 13:22:52.0
jsp中字符串赋值的错误????急救!!!
先贴一下代码:
<%  
UserContainer     nameContainer=(UserContainer)session.getAttribute( "USER ");
String   usertemp=(String)nameContainer.UserName;
      int userPurview=nameContainer.Type;
String   isAudit=null;
…………
%>

UserContainer类的定义
public   class   UserContainer
{
public int Index;
public String UserName;
public String Password;
public int Type;
public int BorderType;
……
}

用的是tomcat架设的服务器
给出的错误提示是;

org.apache.jasper.JasperException:   An   exception   occurred   processing   JSP   page   /admin/left.jsp   at   line   15

12:   <link   href= "/css/style.css "   rel= "stylesheet "   type= "text/css ">
13:   <%  
14:   UserContainer     nameContainer=(UserContainer)session.getAttribute( "USER ");
15:   String   usertemp=(String)nameContainer.UserName;
16:         int userPurview=nameContainer.Type;
17:   String   isAudit=null;
18:   int   tBID=nameContainer.BorderType;


我的session中的USER没有初始值   直接获取
为什么15行会出问题


------解决方案--------------------
if(nameContainer != null)
String usertemp=(String)nameContainer.UserName;
代码迷推荐解决方案:An exception occurred processing JSP page,http://www.daimami.com/search?q=33144
  相关解决方案