Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala “提升积垢”;列出所有;问题_Scala_Crud_Lift - Fatal编程技术网

Scala “提升积垢”;列出所有;问题

Scala “提升积垢”;列出所有;问题,scala,crud,lift,Scala,Crud,Lift,我正在努力学习教程。我有一个非空的数据库。但是表不会被传播。我试着调试它:正确的记录由toShow方法返回,在flatMap的每次迭代中,它都有一个正确的、非空的项实例,但是结果,这个方法返回的是:列表(\n{16空格在这里},\n{16空格在这里})。并且该表不会被传播。 我的更新代码如下: ListCar代码段: class ListCar { def list(xhtml: NodeSeq) : NodeSeq = { toShow.flatMap(car =>

我正在努力学习教程。我有一个非空的数据库。但是表不会被传播。我试着调试它:正确的记录由
toShow
方法返回,在
flatMap
的每次迭代中,它都有一个正确的、非空的项实例,但是结果,这个方法返回的是:
列表(\n{16空格在这里},\n{16空格在这里})
。并且该表不会被传播。 我的更新代码如下:

ListCar代码段:

class ListCar {

  def list(xhtml: NodeSeq) : NodeSeq = {
    toShow.flatMap(car =>
      bind("car", xhtml,
        "name" -> car.name.is,
        "owner" -> car.owner.name
      )
    )
  }

  private def toShow = {
    Car.findAll();
  }

}
list.xhtml:

<table>
    <thead>
    <tr>
        <th>Name</th>
        <th>Owner</th>
    </tr>
    </thead>

    <tbody>
        <lift:list_car.list>
            <tr>
                <td>
                    <car:name/>
                </td>

                <td>
                    <car:owner/>
                </td>
            </tr>
        </lift:list_car.list>
    </tbody>
</table>

名称
所有者
这里可能有什么问题?

请参见此处的示例(在最下面):。不幸的是,我现在无法尝试代码。您可以尝试另外两个选项:

  • “name”->car.name.is
    替换为
    “name”->car.name
    -->
    而不是
    ->
  • “name”->car.name.is
    替换为类似
    “name”->SHtml.text(car.name.is)

  • 我通过编辑html文件解决了这个问题:
    我没有将
    包装在
    中,而是将其改为
    ,它成功了。

    如果将“name”->car.name”改为“name”->car.name.is”会怎么样?这两种方法都不起作用。但我发现了一个有效的方法(我对这个问题的回答)。请注意,这是有效的,因为您在html文件中使用HTML5格式。
    语法仅在使用XHTML格式时有效。