67,538
社区成员
发帖
与我相关
我的任务
分享
@Autowired
ILogService iLogService;
@Autowired
IExceptionService iExceptionService;
@Pointcut("@annotation(xxx.excetpionTest)")
public void exceptionPointcut() {
}
@Around("exceptionPointcut()")
public Object AroundExceptionAdvicing(ProceedingJoinPoint joinPoint) throws Throwable{
Object o=null;
String message="";
try
{
o = joinPoint.proceed();
}
catch (ValidateParametersThrowToAlertException e) {
message = e.getMessage();
iExceptionService.ExceptionProcessed(e);
//在此处处理异常,如果是1,需要弹出提示
//问题1:怎么区分 拦截的这个方法是 action 而不是 普通的方法?普通方法将异常抛出,action的话 需要弹出错误提示,请问咋弹出?
//问题2:怎么区分 当前的系统是使用 mvc还是struct2? 是看返回值吗?ModelAndView or String?
//问题3:如果是action 返回值 是String 那么弹出 提示该怎么弹出?返回String =“javascript:alert("xxx参数不能为空");”这样行吗?
}
catch ....
finally
{
if(!message.isEmpty())
iLogService.putServiceErrorLog(LogLevel.ERROR,LogStorageModel.TEXT, joinPoint, message);
}
return o;
}

