如何在 Play framework 1.2.x 中手动抛出错误404?500
我目前正在使用方法渲染404.html和500.html模板renderTemplate()。但是我该如何以正确的方式做到这一点?
如何在 Play framework 1.2.x 中手动抛出错误404?500
我目前正在使用方法渲染404.html和500.html模板renderTemplate()。但是我该如何以正确的方式做到这一点?
Play 有用于此目的Controller的方法。error()notFound()
在您的控制器中,您可以error()从 Controller 调用静态方法,该方法将提供 500 状态。
返回 internalServerError(filledForm.errorsAsJson());