- 使用twirl模版引擎的@helper相關(guān)方法時,需要引入messages模塊,否則會報no http context異常剩晴,示例:
controller:
class ExampleController @Inject()(cc: ControllerComponents) extends AbstractController(cc)
with play.api.i18n.I18nSupport{
def index = Action{implicit request =>
ok(view)
}
}
模版
@()(implicit messagesProvider: MessagesProvider)
注意隱式轉(zhuǎn)換聲明。
- run命令修改端口
run 8080