How to Manually throw error Pages in Play Framewor

2019-07-18 14:08发布

How do I manually throw a 404 or 500 error in Play framework 1.2.x?

I am currently rendering the 404.html and 500.html templates using renderTemplate() method. But how do I do it the proper way ?

3条回答
Animai°情兽
2楼-- · 2019-07-18 14:31

Play Controller has error() and notFound() methods for this purpose.

查看更多
该账号已被封号
3楼-- · 2019-07-18 14:38

In your controller you can just invoke static error() method from Controller which will give 500 status.

查看更多
三岁会撩人
4楼-- · 2019-07-18 14:45

return internalServerError(filledForm.errorsAsJson());

查看更多
登录 后发表回答