gpt4 book ai didi

java - play框架从2.0.8迁移到2.1.0动态表单找不到符号

转载 作者:行者123 更新时间:2023-12-01 11:58:04 25 4
gpt4 key购买 nike

我已将 Play Framework 从 2.0.8 迁移到 2.1.0,并且遵循此 guide

但我在使用动态表单时收到错误无法找到符号

这是我的代码:

final DynamicForm form = form().bindFromRequest();

                        ^cannot find symbol

我还导入:import play.data.Form;

有人知道我在迁移过程中缺少什么吗?

编辑:这是我的 build.scala

import sbt._
import Keys._
import play.Project._
import com.github.play2war.plugin._

object ApplicationBuild extends Build {val appName = "Lndlabproject"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
"mysql" % "mysql-connector-java" % "5.1.18",
"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
"org.apache.httpcomponents" % "httpclient" % "4.0.3",
"japid42" % "japid42_2.9.1" % "0.5.3",
"org.apache.poi" % "poi" % "3.8",
"org.apache.poi" % "poi-ooxml" % "3.9",
"com.feth" %% "play-easymail" % "0.1-SNAPSHOT",
"org.apache.directory.studio" % "org.apache.commons.io" % "2.4",
"org.apache.ant" % "ant-jsch" % "1.7.1",
javaCore,
javaJdbc,
javaEbean
)

val main = play.Project(appName, appVersion, appDependencies).settings(

Play2WarPlugin.play2WarSettings: _*)
.settings(Play2WarKeys.servletVersion := "2.5")
.settings(

// Add your own project settings here
ebeanEnabled := false,
resolvers += Resolver.url("My GitHub Play Repository", url("http://branaway.github.com/releases/"))(Resolver.ivyStylePatterns),

resolvers += Resolver.url("play-easymail (release)", url("http://joscha.github.com/play-easymail/repo/releases/"))(Resolver.ivyStylePatterns),resolvers += Resolver.url("play-easymail (snapshot)", url("http://joscha.github.com/play-easymail/repo/snapshots/"))(Resolver.ivyStylePatterns)
)}

编辑:

resolved issue by moving javaCore, javaJdbc, javaEbean dependencies upwards.

喜欢

 val appDependencies = Seq(
javaCore,
javaJdbc,
javaEbean,
"mysql" % "mysql-connector-java" % "5.1.18",
"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
"org.apache.httpcomponents" % "httpclient" % "4.0.3",
"japid42" % "japid42_2.9.1" % "0.5.3",
"org.apache.poi" % "poi" % "3.8",
"org.apache.poi" % "poi-ooxml" % "3.9",
"com.feth" %% "play-easymail" % "0.1-SNAPSHOT",
"org.apache.directory.studio" % "org.apache.commons.io" % "2.4",
"org.apache.ant" % "ant-jsch" % "1.7.1",

)

最佳答案

来自Play 2.1 migration guide .

play.mvc.Controller.form() renamed to play.data.Form.form() Also related to modularization, the play.data package and its dependencies were moved out from play core to javaCore artifact. As a consequence of this, play.mvc.Controller#form was moved to play.data.Form#form

DynamicForm form = Form.form().bindFromRequest(); 也是如此

在您的 build.scala 中(即您在下面的注释中显示的)javaCore 依赖项位于末尾

 val appDependencies = Seq( 

"mysql" % "mysql-connector-java" % "5.1.18",

"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",

"org.apache.httpcomponents" % "httpclient" % "4.0.3",

"japid42" % "japid42_2.9.1" % "0.5.3",

"org.apache.poi" % "poi" % "3.8", "org.apache.poi" % "poi-ooxml" % "3.9",

"com.feth" %% "play-easymail" % "0.1-SNAPSHOT",

"org.apache.directory.studio" % "org.apache.commons.io" % "2.4",

"org.apache.ant" % "ant-jsch" % "1.7.1",

javaCore,

javaJdbc,

javaEbean

)

也许 javaCore 依赖项无法加载,因此将 javaCore、javaJdbc、javaEbean 移至顶部

val appDependencies = Seq( 

javaCore,

javaJdbc,

javaEbean,

"mysql" % "mysql-connector-java" % "5.1.18",

"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",

"org.apache.httpcomponents" % "httpclient" % "4.0.3",

"japid42" % "japid42_2.9.1" % "0.5.3",

"org.apache.poi" % "poi" % "3.8", "org.apache.poi" % "poi-ooxml" % "3.9",

"com.feth" %% "play-easymail" % "0.1-SNAPSHOT",

"org.apache.directory.studio" % "org.apache.commons.io" % "2.4",

"org.apache.ant" % "ant-jsch" % "1.7.1"

)

然后做

play clean
play ~run

关于java - play框架从2.0.8迁移到2.1.0动态表单找不到符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28275905/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com