我是新手,遇到的错误是:
[error] F:\Kepler\wefarm\app\views\login.scala.html:8: type mismatch;
[error] found : play.api.mvc.Call
[error] required: Class[?]
[error] @form(routes.Session.authenticate()) {
[error] ^
我在 Session.java 中定义了身份验证函数
public class Session extends Controller {
....
public static Result authenticate() {
Form<Login> loginForm = form(Login.class).bindFromRequest();
if (loginForm.hasErrors()) {
return redirect(routes.Session.login());
} else {
session("connected", loginForm.get().email);
return redirect(routes.Application.index());
}
}
...
}
错误发生在 login.scala.html 上:
@(loginForm: Form[Session.Login])
@import play.data.Form.form
@main("WeFarm") {
<h1>Farmer login</h1>
@form(routes.Session.authenticate()) { ///////------error happens here
@inputText(farmerForm("email"), '_label -> "Email")
@inputPassword(farmerForm("password"), '_label -> "Password")
<input type="submit" class="btn btn-primary" value="Login">
}
我想将身份验证结果放入表单中,表单无法识别它。如何使@form 接受结果?