我已将我的项目从play-slick 0.8迁移到play-slick 1.0(https://github.com/playframework/play-slick)......这意味着将播放版本从2.3更改为2.4,将版本从2.1更改为3.0。
在我的控制器中进行一些更改之后,我现在在模板中收到编译错误:
类型不匹配; 发现:play.twirl.api.HtmlFormat.Appendable(扩展为)play.twirl.api.Html required:String
这是我的模板' createForm.scala.html'。该错误引用了@main块中的第一行,无论它是什么(在这种情况下"添加消防员")。
@(bomberoForm: Form[Bombero], categorias: Seq[(String, String)])(implicit flash: play.api.mvc.Flash, messages: Messages)
@import helper._
@main {
<h1>Add fireman</h1>
@form(routes.BomberosController.save) {
这是我的&#39; main.html&#39;:
@(content: Html)
<!DOCTYPE html>
<html>
<head>
<title>Gestión de turnos</title>
<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("stylesheets/bootstrap.min.css")">
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")"/>
</head>
<body>
<header class="topbar">
<h1 class="fill">
<a href="@routes.BomberosController.index()">
Gestión de turnos
</a>
</h1>
</header>
<section id="main">
@content
</section>
</body>
</html>
这是我的控制者:
class BomberosController @Inject() (val messagesApi: MessagesApi, bomberos: Bomberos)
extends Controller with I18nSupport {
/**
* This result directly redirect to the bomberos management home.
*/
val Home = Redirect(routes.BomberosController.list(0, 1, ""))
/**
* Describe the bombero form (used in both edit and create screens).
*/
val bomberoForm: Form[Bombero] = Form(
mapping(
"matricula" -> number,
"nombre" -> nonEmptyText,
"apellidos" -> nonEmptyText,
"categoria" -> number,
"fechaDeIngreso" -> jodaLocalDate("dd/MM/yyyy"),
"parque" -> nonEmptyText,
"letra" -> nonEmptyText(1,1)
)((m, n, a, c, f, p, letra) => Bombero(m, n, a, c, f, p, letra.head))
((b: Bombero) => Some(b.matricula, b.nombre, b.apellidos, b.categoria, b.fechaDeIngreso, b.parque, b.letra.toString))
)
def index = Action { Home }
def list(page: Int, orderBy: Int, filter: String) = Action.async { implicit request =>
for {
bomberosList <- bomberos.list(page = page, orderBy = orderBy, filter =("%"+filter+"%"))
} yield
Ok(views.html.bomberos.list(bomberosList, orderBy, filter))
}
def create = Action.async { implicit request =>
for (catOpts <- bomberos.categoriasOptions) yield
Ok(views.html.bomberos.createForm(bomberoForm, catOpts))
}
....
为什么我收到此错误的任何想法?