Default settings for Play Java applications

I started worked with a play example and encountered this error.


package controllers;

 

import models.Proposal;

 

import play.data.Form;

import play.mvc.Controller;

import play.mvc.Result;

import play.mvc.Results;

import models.*;

 

public class MainController extends Controller {

  

    public static Result welcome(String name) {

        return ok("<h1> Welcome " + name + "</h1>").as("text/html");

    }

 

    public static Result index() {

        return ok(views.html.index.render("Hi from Java"));

    }

    

    public static Result newProposal(){

    Form<Proposal> proposalForm = Form.form(Proposal.class);

    

    return ok(views.html.newProposal.render(proposalForm));

    }

    

    public static Result submitProposal(){

    return Results.TODO;

    }

    

}

Error

[error] /Users/radhakrishnan/Documents/hello-play/app/controllers/MainController.java:23: error: incompatible types: play.data.Form cannot be converted to play.api.data.Form
[error] return ok(views.html.newProposal.render(proposalForm));

I struggled with this error until I set play.Project.playJavaSettings in my build.sbt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: