Answer the question
In order to leave comments, you need to log in
How in the rest-controller to accept form data, which can change the number of fields?
There is a form, the number of fields in which is not fixed, but can change. Moreover, among the fields there are not only string ones, but also for uploading files.
I don't understand how I can accept this heap in the rest controller:
@PostMapping("/test-type-questions")
public ResponseEntity<String> createTestTypeQuestion(@RequestParam Map<String, String> data)
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Usually, there is a separate controller responsible for downloading files. You can create a RestController, to which uploaded files are sent by Ajax, and in the response return the id of the file stored in the database after uploading.
If you decide to implement the way you currently do it, then why not try using a model (DTO). Create a pojo of the desired structure, if there are required fields that must be present, then use spring validation.
If necessary, use ModelMapper or Struts or class Converter<S, T>
to convert dto to entity
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question