在子文件夹中找不到视图

编程入门 行业动态 更新时间:2024-10-28 16:18:55
本文介绍了在子文件夹中找不到视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚刚开始使用Play2.0 Framework,我正在尝试在 home / index 模板中使用主模板。我遇到的问题是,当它在Shared文件夹中找不到main时,如果我将它取出并放入Views根目录,那么它可以正常工作。

I just started using the Play2.0 Framework and I'm trying to use the main template in my home/index template. The issue I'm having is it can't find "main" when its in the Shared folder, if I take it out and put it in the Views root then it works fine.

所以我想知道如何从引用 main.scala.html index.scala.html ?

So I'm wondering how I can reference the main.scala.html from index.scala.html?

我的文件夹结构如下:

  • 查看
    • 主页
      • index.scala.html
      • main.scala.html

      我的代码在 index.scala.html 是:

      @head = { } @content = { <b>Home Screen</b>!! } ERROR: @main(title = "Home",head, content)

      我得到的错误是:

      not found: value main.

      推荐答案

      一旦你进入视图的子文件夹就会有这样的感觉伪包称为html。我不完全确定它是如何工作的但是试试这个:

      Once you get into subfolders for views there is this like "pseudo-package" called "html". I'm not entire sure how it works but try this:

      @views.html.Shared.main

更多推荐

在子文件夹中找不到视图

本文发布于:2023-11-13 10:05:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584089.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   视图   子文   夹中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!