Good day! You must implement login / logout as in this example, but you need to return a json response instead of a redirect to the jsp form. I know that in the controller, the return type should be DTO instead of a string. Tell me what needs to be changed in the project and how to create a DTO for login / logout / registration correctly.

    1 answer 1

    Try to add the @ResponseBody annotation over the controller's method to change the type of the returned object to the created dto class and, accordingly, you need to return an object of this type.

    • how to create DTO for login / logout / registration? I can not find an example - Serhei Ivanov
    • dto is the usual java class. public class loginDto {private String login; private String password; } there you declare any fields that you want the server to return to you in the form of json and that's it. I would suggest more specifically, but without knowing the task I cannot. - Alexsander Ostrikov