jsp中try catch 问题
城序缘 2014-09-29 10:34:59 try{
Groups group = Groups.getByName(groupName);
}catch(IOException e){
System.out.println("here");
}
同样的代码,放在.java文件中就是正常的,放在jsp的<%%>代码块中就提示Unreachable catch block for IOException. This exception is never thrown from the try statement body。
getByName()方法是有throw IOException的,在.java文件中如果不加try catch都会报错。在jsp加了为什么报上述错误。
补充一点,如果把catch块的IOException换成Exception是正常工作的,且用e.getCause()方法得到的对象也是一个IOException示例