我更喜欢使用控制器,因为我可以使用它来触发模型逻辑,然后进行某种验证处理,接着将用户路由到一个相应的错误处理或结果页。
I prefer to use a controller, because I can use it to fire the model logic, then do some validation processing, and then route the user to an error-handling or result page as appropriate.
您正在将远程调用封装在一个服务器端控制器中,因此可以在这里加强错误处理。
You're encapsulating the remote call in a server-side controller, so you might choose to do some more extensive error correction there.
但是它们可以保证调用了业务逻辑,保证控制器逻辑没有检测到任何错误,并保证得到了正确的HTTP响应。
But they make sure that the business logic is invoked, that the controller logic doesn't detect any errors, and that the right HTTP response is achieved.
应用推荐