【问题标题】:Too many arguments for method apply方法应用的参数太多
【发布时间】:2016-04-04 15:09:54
【问题描述】:

我在 Scala 中做一个小 Play 应用程序,当我想打开我的应用程序时收到此错误:

方法应用的参数太多:(标题:字符串)(内容:play.twirl.api.Html)(隐式消息:play.api.i18n.Messages)play.twirl.api.HtmlFormat.Appendable in class main

我不知道我的代码有什么问题,这里是我的代码的快速视图:

main.scala.html:

@(title: String )(content: Html)(implicit messages: Messages)
<!DOCTYPE html>
    <html>
          <head>
                <title>@title</title>
                <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
          </head>

这里是viewseleves.scala.html

@(eleves: Seq[Eleve])(implicit flash: Flash, messages: Messages)
@main(messages("title.eleves"), Some("viewEleves")){
  <div id="type_ead" class="list">
    <fieldset>
      <legend>@messages("institutions.list.institutions")</legend>

错误画面:

error

【问题讨论】:

    标签: scala playframework playframework-2.2


    【解决方案1】:

    在这一行:

    @main(messages("title.eleves"), Some("viewEleves"))
    

    您已将两个参数传递给模板创建的 main 函数,但它应该只接受一个参数,一个名为 titleString

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-03
      • 2019-01-09
      • 2016-02-26
      • 1970-01-01
      • 1970-01-01
      • 2012-11-03
      相关资源
      最近更新 更多