天天看点

Failed to load resource: the server responded with a status of 404 ()

错误 1Failed to load resource: the server responded with a status of 404 ()

错误2  id to load is required for loading

错误3

java.lang.IllegalArgumentException: id to load is required for loading

原因一:出现这个异常的是使用struts标签进行传值导致的,如:

<s:a action="role_delete?id=%{id}" οnclick="return confirm('确定要删除吗?')">删除</s:a>

<s:a action="role_editUI?id=%{id}">修改</s:a>

使用上面的方式传id则出现java.lang.IllegalArgumentException: id to load is required for loading异常,导致id为null,究其原因是因为木有将id的值传递过去

改成

<a href="role_delete?id=${id}" target="_blank" rel="external nofollow" οnclick="return confirm('确定要删除吗?')">删除</a>

<a href="role_editUI?id=${id}" target="_blank" rel="external nofollow" >修改</a>

则可以不会出现这个异常

原因二:在调用有关id的方法里没有进行空值判断

if(id==null){

return null;

}else{

执行操作...............

}