FAQ
hi Mohan, how did you fix this problem, can you explain that to me? i am
new to play and got the same error as you when i follow the tutorial
from https://typesafe.com/how/online-training/play-java

Thanks
Rudy
On Friday, February 21, 2014 7:16:57 AM UTC-5, Mohan Radhakrishnan wrote:

Hi,

I started worked with a play example and encountered this error. Does
it look like a configuration error ? I may have missed something.

public static Result newProposal(){

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

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

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

My build file has

name := """hello-play"""


version := "1.0-SNAPSHOT"


libraryDependencies ++= Seq(

// Select Play modules

//jdbc, // The JDBC connection pool and the play.api.db API

//anorm, // Scala RDBMS Library

//javaJdbc, // Java database API

javaEbean, // Java Ebean plugin

"mysql" % "mysql-connector-java" % "5.1.26",

//javaJpa, // Java JPA plugin

//filters, // A set of built-in filters

javaCore, // The core Java API

// WebJars pull in client-side web libraries

"org.webjars" %% "webjars-play" % "2.2.0",

"org.webjars" % "bootstrap" % "2.3.1"

// Add your own project dependencies in the form:

// "group" % "artifact" % "version"

)


play.Project.playScalaSettings

Thanks,
Mohan
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Greg Nieman at May 20, 2014 at 7:32 pm
    In your build.sbt make sure you have:
    play.Project.playJavaSettings
    not:
    play.Project.playScalaSettings

    And when you check the API, make sure to go to the Java version, for
    instance:
    http://www.playframework.com/documentation/2.2.x/api/java/index.html

    -greg

    On Tuesday, May 20, 2014 1:31:45 PM UTC-4, Rudy Zhang wrote:

    hi Mohan, how did you fix this problem, can you explain that to me? i am
    new to play and got the same error as you when i follow the tutorial from
    https://typesafe.com/how/online-training/play-java

    Thanks
    Rudy
    On Friday, February 21, 2014 7:16:57 AM UTC-5, Mohan Radhakrishnan wrote:

    Hi,

    I started worked with a play example and encountered this error. Does
    it look like a configuration error ? I may have missed something.

    public static Result newProposal(){

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

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

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

    My build file has

    name := """hello-play"""


    version := "1.0-SNAPSHOT"


    libraryDependencies ++= Seq(

    // Select Play modules

    //jdbc, // The JDBC connection pool and the play.api.db API

    //anorm, // Scala RDBMS Library

    //javaJdbc, // Java database API

    javaEbean, // Java Ebean plugin

    "mysql" % "mysql-connector-java" % "5.1.26",

    //javaJpa, // Java JPA plugin

    //filters, // A set of built-in filters

    javaCore, // The core Java API

    // WebJars pull in client-side web libraries

    "org.webjars" %% "webjars-play" % "2.2.0",

    "org.webjars" % "bootstrap" % "2.3.1"

    // Add your own project dependencies in the form:

    // "group" % "artifact" % "version"

    )


    play.Project.playScalaSettings

    Thanks,
    Mohan
    --
    You received this message because you are subscribed to the Google Groups "play-framework" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Rudy Zhang at May 21, 2014 at 1:08 am
    hi Greg, i put the play.Project.playJavaSettings in my build.sbt file, but
    i still get that error, i use win7, Java 8, Eclipse Standard/SDK Version:
    Kepler Service Release 2, typesafe play framework. i also post some of my
    files here:

    *here is my build.sbt*

    name := """hello-play"""

    version := "1.0-SNAPSHOT"

    libraryDependencies ++= Seq(
       javaCore, // The core Java API
       javaEbean,
       "mysql" % "mysql-connector-java" % "5.1.26",
       "org.webjars" %% "webjars-play" % "2.2.0",
       "org.webjars" % "bootstrap" % "2.3.1"
    )

    play.Project.playJavaSettings


    *here is my MainController.java:*

    package controllers;

    import play.mvc.Controller;
    import play.mvc.Result;
    import play.mvc.Results;
    import play.data.*;
    import models.*;

    public class MainController extends Controller {

         public static Result welcome(String name){
             return ok("<hl> Welcome " + name + "</hl>").as("text/html");
         }

         public static Result index() {
             return ok(views.html.index.render("Hello 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;
         }

    }


    and i am also getting errors like views.html.index cannot be resolved to a
    type, and views.html.newProposal cannot be resolved to a type too


    On Tuesday, May 20, 2014 3:31:52 PM UTC-4, Greg Nieman wrote:

    In your build.sbt make sure you have:
    play.Project.playJavaSettings
    not:
    play.Project.playScalaSettings

    And when you check the API, make sure to go to the Java version, for
    instance:
    http://www.playframework.com/documentation/2.2.x/api/java/index.html

    -greg

    On Tuesday, May 20, 2014 1:31:45 PM UTC-4, Rudy Zhang wrote:

    hi Mohan, how did you fix this problem, can you explain that to me? i am
    new to play and got the same error as you when i follow the tutorial from
    https://typesafe.com/how/online-training/play-java

    Thanks
    Rudy
    On Friday, February 21, 2014 7:16:57 AM UTC-5, Mohan Radhakrishnan wrote:

    Hi,

    I started worked with a play example and encountered this error. Does
    it look like a configuration error ? I may have missed something.

    public static Result newProposal(){

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

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

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

    My build file has

    name := """hello-play"""


    version := "1.0-SNAPSHOT"


    libraryDependencies ++= Seq(

    // Select Play modules

    //jdbc, // The JDBC connection pool and the play.api.db API

    //anorm, // Scala RDBMS Library

    //javaJdbc, // Java database API

    javaEbean, // Java Ebean plugin

    "mysql" % "mysql-connector-java" % "5.1.26",

    //javaJpa, // Java JPA plugin

    //filters, // A set of built-in filters

    javaCore, // The core Java API

    // WebJars pull in client-side web libraries

    "org.webjars" %% "webjars-play" % "2.2.0",

    "org.webjars" % "bootstrap" % "2.3.1"

    // Add your own project dependencies in the form:

    // "group" % "artifact" % "version"

    )


    play.Project.playScalaSettings

    Thanks,
    Mohan
    --
    You received this message because you are subscribed to the Google Groups "play-framework" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Ashwini Bharadwaj at May 26, 2014 at 3:03 am
    Hi,

    I had to run the "reload" command on the play console before the
    playJavaSettings in my build.sbt took effect. Just compile/run wouldn't
    take it into effect.

    Cheers

    On Tuesday, May 20, 2014 6:08:38 PM UTC-7, Rudy Zhang wrote:

    hi Greg, i put the play.Project.playJavaSettings in my build.sbt file, but
    i still get that error, i use win7, Java 8, Eclipse Standard/SDK Version:
    Kepler Service Release 2, typesafe play framework. i also post some of my
    files here:

    *here is my build.sbt*

    name := """hello-play"""

    version := "1.0-SNAPSHOT"

    libraryDependencies ++= Seq(
    javaCore, // The core Java API
    javaEbean,
    "mysql" % "mysql-connector-java" % "5.1.26",
    "org.webjars" %% "webjars-play" % "2.2.0",
    "org.webjars" % "bootstrap" % "2.3.1"
    )

    play.Project.playJavaSettings


    *here is my MainController.java:*

    package controllers;

    import play.mvc.Controller;
    import play.mvc.Result;
    import play.mvc.Results;
    import play.data.*;
    import models.*;

    public class MainController extends Controller {

    public static Result welcome(String name){
    return ok("<hl> Welcome " + name + "</hl>").as("text/html");
    }

    public static Result index() {
    return ok(views.html.index.render("Hello 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;
    }

    }


    and i am also getting errors like views.html.index cannot be resolved to a
    type, and views.html.newProposal cannot be resolved to a type too


    On Tuesday, May 20, 2014 3:31:52 PM UTC-4, Greg Nieman wrote:

    In your build.sbt make sure you have:
    play.Project.playJavaSettings
    not:
    play.Project.playScalaSettings

    And when you check the API, make sure to go to the Java version, for
    instance:
    http://www.playframework.com/documentation/2.2.x/api/java/index.html

    -greg

    On Tuesday, May 20, 2014 1:31:45 PM UTC-4, Rudy Zhang wrote:

    hi Mohan, how did you fix this problem, can you explain that to me? i am
    new to play and got the same error as you when i follow the tutorial from
    https://typesafe.com/how/online-training/play-java

    Thanks
    Rudy
    On Friday, February 21, 2014 7:16:57 AM UTC-5, Mohan Radhakrishnan wrote:

    Hi,

    I started worked with a play example and encountered this error.
    Does it look like a configuration error ? I may have missed something.

    public static Result newProposal(){

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

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

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

    My build file has

    name := """hello-play"""


    version := "1.0-SNAPSHOT"


    libraryDependencies ++= Seq(

    // Select Play modules

    //jdbc, // The JDBC connection pool and the play.api.db API

    //anorm, // Scala RDBMS Library

    //javaJdbc, // Java database API

    javaEbean, // Java Ebean plugin

    "mysql" % "mysql-connector-java" % "5.1.26",

    //javaJpa, // Java JPA plugin

    //filters, // A set of built-in filters

    javaCore, // The core Java API

    // WebJars pull in client-side web libraries

    "org.webjars" %% "webjars-play" % "2.2.0",

    "org.webjars" % "bootstrap" % "2.3.1"

    // Add your own project dependencies in the form:

    // "group" % "artifact" % "version"

    )


    play.Project.playScalaSettings

    Thanks,
    Mohan
    --
    You received this message because you are subscribed to the Google Groups "play-framework" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupplay-framework @
categoriesscala
postedMay 20, '14 at 5:32p
activeMay 26, '14 at 3:03a
posts4
users3
websiteplayframework.org
irc#playframework

People

Translate

site design / logo © 2018 Grokbase