小编ste*_*pjm的帖子

Play Framework - 值login不是controllers.Application的成员

我正在运行最新的Play Framework 2.5.1,我从登录页面收到错误:

错误:

value login is not a member of controllers.Application
Run Code Online (Sandbox Code Playgroud)

我试过添加@符号即:

@controllers.Application.login()
Run Code Online (Sandbox Code Playgroud)

并从build.sbt"CMD"中清除/清理文件和更新中删除注射器.我正在使用https://www.playframework.com/documentation/2.1.0/JavaGuide中的示例.

HTML代码

@(form: Form[Application.Login])
<html>
    <head>
        <title>Zentasks</title>
        <link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
        <link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.versioned("stylesheets/login.css")">
    </head>
    <body>
        <header>
            <a href=@routes.Application.index" id="logo"><span>Zen</span>tasks</a>
        </header>

    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

CONTROLLERS

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public Result index() {
        return ok(index.render("Your new application is ready."));
    }



    public static Result login() {
        return ok(
            login.render(form(Login.class)) …
Run Code Online (Sandbox Code Playgroud)

java playframework

2
推荐指数
1
解决办法
5730
查看次数

标签 统计

java ×1

playframework ×1