在我的应用程序中,我在 web.xml 中配置了一个错误页面。我需要根据条件为特定控制器覆盖它。在这里,当条件变为真时,我需要重定向到特定的错误页面,否则应该呈现正常的错误页面。这是代码。请帮我。
@Controller
public class Test{
 @ExceptionHandler(Exception.class)
 public ModelAndView generateException(HttpServletRequest httpServletRequest){
  if(condition) {
   return new ModelAndView("myError.jsp");
  } else {
   //should execute default error page.
  }
 }
}