I created Spring Boot application with data JPA and add Dev Tool dependency and created one simple login page in JSP and and Registration page . when I fill register form and register data is fetch in controller using @ModelAttribute and save this data to Data Base and go back to login page and refresh login page 2 or 3 times then my data save 2,3 times in data base. User Entity Class
Asked
Active
Viewed 78 times
0
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 24 '22 at 09:26
1 Answers
0
Looks as if you are directly returning a view after a post request, when you should be redirecting. Returning a redirect response to the page you need after succesful registration should fix your problem. The easiest way to do it in spring in your case should be returning - "redirect:/your-redirect-url".
This SO question should be useful as well.
Also this - how to redirect.

Chaosfire
- 4,818
- 4
- 8
- 23