폼 검증 예외가 @ExceptionHandler (유연해야 함)와 SimpleMappingExceptionResolver에 의해 일반적인 시스템 예외에 의해 처리되는 웹 어플리케이션을 개발했습니다. 이메일 통지 등).Spring Exception Handling - ExceptionResolver와 @ExceptionHandler를 동시에 사용하는 방법
둘 다 사용하는 경우 @ExceptionHandler에 매핑되는 예외는 @ExceptionHandler에 전달되지 않지만 ExceptionResolver는 defaultError로 움 직입니다.
함께 사용하려면 어떻게해야할까요? DispatcherPortlet에에서
@ActionMapping(params = "action=addDocOrder")
public void addDocOrder(@ModelAttribute("order") CstOrderBeanImpl orderBean, BindingResult result, ActionRequest actionRequest, ActionResponse response)
throws PortalException, SystemException, ValidatorException {
logger.info("Adding Form Order");
Calendar cal = TimeUtils.getEuDeadLine(orderBean);
orderBean.setDeadLine(cal.getTime());
ValidatorException ve = validateService.validate(orderBean, result, actionRequest, validator);
if(ve != null)
throw ve;
@ExceptionHandler(ValidatorException.class)
public String handleFormException(ValidatorException ex, ActionRequest actionRequest) {
logger.error(ex.getMessage());
//TODO make conditions
return "mainOrderForm";
}
는 인터셉터를 확인, 그러나 아무도 그것을 기본 ...
을하지 그래서 난 그냥 지적, 존재하지
catch (Exception ex) {
// Trigger after-completion for thrown exception.
triggerAfterActionCompletion(mappedHandler, interceptorIndex, processedRequest, response, ex);
있다 , 그게 포틀릿 환경, 일반적으로 적은 "전망"... 매개 변수에 의해 주도 ..
안녕하세요 heikkim, 이것은 정확히 내가 한 일입니다. 처리기에서 메서드를 호출하지 않았지만 방금 확인했습니다. instanceof ValidatorException) 내가 필요한 것을했습니다. 하지만 당신이 제안한 것이 더 합리적입니다. 논리가 핸들러에있을 때 예외가 아니라면 더 투명합니다. – lisak