helper.form 对路由控制器的操作不会在 play 2.7 或 2.6 中使用编译时 DI 注入来选择 play.http.context 或前缀



play.http.context假设在所有路线和资产的URL路径中添加上下文

我尝试过play.http.context ="/test",并在使用bundiNcomponents from fromContext

中添加了"/tests"的前缀为"/tests"。

在application.conf

play.http.context =/tests

login.scala.html看起来像

@helper.form(action = routes.logincontroller.authenticate(

路线看起来像

post/login Controller.logincontroller.authenticate

html生成

form action ="/login" method =" post"

我希望动作是动作="/tests/登录",因为我的play.http.context是"/tests",并且还添加了前缀,以使用"/tests"白色创建route freate route farne incomponents from fromContext

<</p>

在application.conf文件中添加以下行。我已经在项目中使用了Play 2.7

play.http.context = "/test"

我通过使用with prefix而不是在创建路由对象时将前缀作为参数来工作。

新路线(......(。使用prefix("/test"(

最新更新