在Play框架中,ModelAndView有直接的等价性吗?如果不是,我如何在游戏中重新创建使用这个类的SpringMVC代码,他们的一些简单代码可以做到吗?
发布于 2015-07-28 15:10:10
这并不是说您有一个像ModelAndView这样的容器。ModelAndView (基本上是一个Map<String, Object>)的目的主要是有一个容器,您可以在其中将模板中使用的所有数据放入其中,并给每个数据块取一个名称。在游戏中,您只需直接将模板的所有对象交给模板即可。
游戏中的一个例子看起来可能是:
public Result index() {
// Somehow instantiate anObject and anotherObject
return ok(views.html.Controller.index(anObject, anotherObject));
}您的模板index.html.scala将从以下内容开始:
@(anObject: AnObjectType, anotherObject: AnotherObjectType)https://stackoverflow.com/questions/31678554
复制相似问题