【发布时间】:2014-11-21 22:23:08
【问题描述】:
我首先想说的是,我对玩框架是全新的,我从 'whereIsMyDipp' 的 youtube 教程中获得了这段代码,但它不起作用,我查看了文档和其他教程并且可以'想不出这个。我正在使用的播放版本是 2.3.6 我正在尝试使用 @helper 的东西创建一个基本的联系人表单,但我收到了这个错误: 截图链接:http://imgur.com/keKda1G
not found: value contactForm
这是我的看法:
@import helper._
@import helper.twitterBootstrap._
@(contactForm: Form[Contact])
@main("wat"){
@helper.form(action = routes.Application.contactSubmit()) {
@helper.inputText(contactForm("fName"))
@helper.inputText(contactForm("lName"))
@helper.inputText(contactForm("phone"))
@helper.inputText(contactForm("email"))
@helper.inputText(contactForm("subject"))
@helper.inputText(contactForm("message"))
}
}
下面是相关的Action方法和模型:
public class Contact {
String fName;
String lName;
String phone;
String email;
String subject;
String message;}
final static Form<Contact> contactForm = form(Contact.class);
public static Result ContactUs() {
return ok(ContactUs.render(contactForm));
}
public static Result contactSubmit() {
Form<Contact> filledForm = form(Contact.class).bindFromRequest();
Contact created = filledForm.get();
return ok(submit.render(created));}
【问题讨论】:
标签: java scala playframework playframework-2.0