Answer the question
In order to leave comments, you need to log in
How to store session related data?
I want to make a student testing application on Spring MVC, Spring DataJPA, Hibernate stack.
Testing will be unusual. When a student starts the test, an array of questions is generated for him. If a student incorrectly answers a question, then more questions on this topic should be added to the end of this array.
Example:
A student starts testing on the topic "Cats". An array is formed with the following questions:
"Кошки мяукают?"
"У кошек бывают котята?"
"Кошки едят грибы?"
"Кошки мяукают?" // Ответил верно
"У кошек бывают котята?" // Ошибка!
"Кошки едят грибы?"
"Котята бывают у кошек?" // Добавлено после ошибки
"Котята - это кошки?" // Добавлено после ошибки
Answer the question
In order to leave comments, you need to log in
Is it possible to store the list directly in the session? Perhaps, but it's not entirely clear why. The session is not meant for that. There you can store some attributes about the user that will help in authorization, for example, his group, ip, identifier.
You can simply make a service that will store a temporary list of questions, for example, based on Map
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question