The .enablePlugins (PlayScala) parameter is set in the built.sbt file, which sets my project to scala.
Now I want to use Java. I found that there are two versions of data.Form (play.data._ and import play.api.data._). Therefore, I used a complete list of parameters for the parameter list.
@(loginForm: play.data.Form[User_LoginForm]) @import helpers._ @helper.form(action = routes.ApplicationJava.login(), 'id -> "loginForm") { @helper.inputText(loginForm("username")) @helper.inputPassword(loginForm("password")) }
But now I have the same problem with helper functions, and I donβt know what is the full name for the helper to work with play.data.Form (Java).
Is there a way to use helper functions for Java even if the project is set to scala?
Edit:
The error message for this line -> @ helper.inputText (loginForm ("username")) <<is:
type mismatch; found : play.data.Form.Field required: play.api.data.Field
Edit:
Here is the relevant part of my Java controller.
public static Result showForm() { Form<User_LoginForm> userForm = play.data.Form.form(User_LoginForm.class); User_LoginForm ulf = new User_LoginForm(); ulf.username = "abc"; userForm = userForm.fill(ulf); return ok(views.html.userLoginJava.render(userForm)); }
java scala playframework
bebo
source share