【发布时间】:2011-10-14 13:35:43
【问题描述】:
我正在处理一个遗留项目,将其转换为基于注释的 MVC。我在 onsubmit 方法中注意到很多时候遵循以下模式:
public ModelAndView onSubmit(Command command) {
try {
service.doSomeBusinessLogic(command);
}
catch (ServiceException) {
//return one type of model and view here
}
//return another type of model and view here
}
在我看来,这个异常处理放在这里是错误的,但我不确定 spring 给了我什么替代解决方案?有什么想法,或者这不是我想的反模式吗?
【问题讨论】:
标签: java spring model-view-controller