我是 Spring MVC 的新手。我有一个捕捉异常的控制器,在捕捉到异常后我想重定向到error.jsp页面并显示异常消息(ex.getMessage())。我不想使用 Spring 的异常处理程序,而是必须以编程方式重定向到 error.jsp。
@RequestMapping(value = "http/exception", method = RequestMethod.GET)
public String exception2()
{
    try{
        generateException();
    }catch(IndexOutOfBoundsException e){
        handleException();
    }
    return "";
}
private void generateException(){
    throw new IndexOutOfBoundsException();      
}
private void handleException(){
    // what should go here to redirect the page to error.jsp
}