玩!框架-创建简单的HTML链接 [英] Play! Framework - creating simple html links

查看:71
本文介绍了玩!框架-创建简单的HTML链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用多个HTML文件和一个CSS文件创建的网站.我目前正在尝试切换到Play! Scala框架.由于某种原因,我很难弄清楚如何将一个html页面链接到另一个html页面.

I have a website that I have made using several HTML files and one CSS file. I am currently attempting to switch over to the Play! Scala Framework. For some reason I am having a really hard time figuring out how to link one html page to another.

现在,我所有的html文件都以"index.scala.html","aboutpage.scala.html"等名称保存在"views"文件夹中.在简单的HTML中,要创建指向新页面的按钮链接,它看起来像这样:

Right now all my html files are saved in the 'views' folder with names such as "index.scala.html", "aboutpage.scala.html" and so on. In simple HTML, to create a button link to a new page it looks something like this:

        <form action="index.html" method="get">
            <button class="navlink">Home</button>
        </form> 
        <form action="aboutpage.html" method="get">
            <button class="navlink">About Us</button>
        </form>
        <form action="publications.html" method="get">
            <button class="navlink">Publications</button>
        </form>

这不适用于Play!显然,我认为我可能需要使用Application和controllers文件.您如何通过Play!在网站中创建不同的页面?

This does not work on Play! obviously, I think I may need to work with the Application and controllers files. How do you go about creating different pages in your website through Play!?

谢谢

推荐答案

查看反向路由:

假设您有这样的路线:

GET   /about          controllers.Application.about()

您可以将HTML更改为此:

You can change your HTML to this:

<form action="@routes.Application.about()" method="get">

这篇关于玩!框架-创建简单的HTML链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆