简体   繁体   English

如何使用Java映射PlayFramework 2.x的复杂对象

[英]How to map complex objects for PlayFramework 2.x using Java

I'm working with PlayFramework 2.1 using Java 我正在使用Java使用PlayFramework 2.1

I want to be able to pass an Assessment object to a scala.html form, have the user select their answers and submit that Assessment object back to a Controller and parse through the data. 我希望能够将评估对象传递给scala.html表单,让用户选择答案,然后将该评估对象提交回Controller并解析数据。 In total I am dealing with 3 classes Assessment, Question, Response 我总共要处理3个类别的评估,问题,回应

Map of my data structure:
Assessment will container 20 Question objects{
   each Question will contain 4 Response objects{

   }

}

the assessment is created on the fly and the questions will be either checkboxes or radio buttons 评估是即时创建的,问题将是复选框或单选按钮

my question is: How would I go about this, I was able to find some basic form tutorials that deal with simple Java objects but this one seems like it would require some knowledge on Mapping. 我的问题是:我将如何处理这个问题,我能够找到一些处理简单Java对象的基本形式教程,但是这似乎需要一些有关Mapping的知识。 Can someone please help me out? 有人可以帮我吗?

You can find an example in the Play samples folder or here . 您可以在“播放示例”文件夹中或此处找到示例。 In that example (forms), there is a Contact class which contains a List which contains a List. 在该示例(窗体)中,有一个Contact类,其中包含一个List,该List包含一个List。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM