inc/dbsfunc.jsp页面下的类: class myFunction{ //取得设备名称 void GetDevName(Object DeviceId){ String GetDevName; Statement st_DeviceCode; st_DeviceCode=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String sql_DeviceCode="select count(*) coun from DeviceCode where DeviceId like'"+Trim(DeviceId) +"'" ; ResultSet rs_DeviceCode=st_DeviceCode.executeQuery(sql_DeviceCode); int Count=rs_DeviceCode.getInt(coun); if(Count>0) GetDevName =( "未知设备(" + DeviceId + ")"); else GetDevName = Trim(rs_DeviceCode("DeviceName")); rs_DeviceCode.close(); } } 提示:Cannot refer to a non-final variable conn inside an inner class defined in a different method