Answer the question
In order to leave comments, you need to log in
How to use DTO pattern correctly?
Hello. There is a small project on the spring, on the timelif view. I have a question about dto. I'm making a "contact us" form. This form has fields: name, subject, mail, message. So, I don’t have such an entity and I don’t need it, should I create a dto for this? and if I create a dto, then should I do all the appeal to the view through dtohi? Question more at the convention for the project
Answer the question
In order to leave comments, you need to log in
In this case, it will not be a DTO, but a Value Object, which in Spring WebMVC is marked with the @ModelAttribute annotation.
Using a Value Object instead of a set of query parameters is definitely better and more convenient.
You can read about it here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question