简体   繁体   中英

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

I'm working with PlayFramework 2.1 using Java

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. In total I am dealing with 3 classes Assessment, Question, Response

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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