一个关于ArrayList的问题,求大虾帮我看看错在那里?
ArrayList list=(ArrayList)request.getAttribute( "list ");
String error=(String)request.getAttribute( "error ");
if(list==null)
{
if(error==null)
{
list=bean.getList( "select * from sp ",1);
}
}
------解决方案--------------------Object obj1 = request.getAttribute( "list ");
Object obj2 = request.getAttribute( "error ");
List list = null;
String error = null;
if(obj1 == null){
if(obj2 == null){
list=bean.getList( "select * from sp ",1);
}else{
error=(String)obj2;
}
}else{
list=(List)obj1;
}