English 中文(简体)
在“游戏2”(斯卡拉)中创建习俗现场建筑商
原标题:Creating a custom field constructor in Play 2 (scala)
最佳回答

在教学过程中,该法典沿用了以下案文:

Often you will need to write your own field constructor. Start by writing a template like:

这意味着,你必须建立自己的模板(xx.scala.html),并在内部添加该代码。 之后,你在你的模板中以它们提供的代码进口该模板(补充的是,在使用你的习俗领域的每张缩略式模板中):

@implicitField = @{ FieldConstructor(xxxx.f) }

表格样本对照“游戏”的样本,采用与“Twitter”boot锁类似的方法。

问题回答

我刚才也存在同样的问题,我同意你的意见,这些文件根本不明确。

www.un.org/spanish/ecosoc 可能的错误 1

not found: value FieldConstructor

这意味着,你没有按照这一指示进口助手:

@import helper._

www.un.org/spanish/ecosoc 可能的错误 2

not found: value implicitConstructor

这意味着,你在模版(即:@helper.form方法)中宣布外地建筑商为错误的地方。 为了解决这个问题,我是在我的进口指示之后宣布我的外地建筑商:

@import form._
@import helper._

@implicitConstructor = @{ FieldConstructor(foundation_field.render) }

(My Foundation_field.scala.html文档见于意见。) 表格包。





相关问题
How to flatten a List of different types in Scala?

I have 4 elements:List[List[Object]] (Objects are different in each element) that I want to zip so that I can have a List[List[obj1],List[obj2],List[obj3],List[obj4]] I tried to zip them and I ...

To use or not to use Scala for new Java projects? [closed]

I m impressed with Twitter and investigating to use Scala for a new large scale web project with Hibernate and Wicket. What do you think about Scala, and should I use it instead of Java? EDIT: And, ...

Why does Scala create a ~/tmp directory when I run a script?

When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...

Include jar file in Scala interpreter

Is it possible to include a jar file run running the Scala interpreter? My code is working when I compile from scalac: scalac script.scala -classpath *.jar But I would like to be able to include a ...

Scala and tail recursion

There are various answers on Stack Overflow which explain the conditions under which tail recursion is possible in Scala. I understand the limitations and how and where I can take advantage of tail ...

热门标签