Using JSP to display the form is fine. What is
not fine is putting the
Java code in your JSP. That's a poor practice that has been discredited for more than 10 years. 10 years! Don't you think it's time to catch up?
The Java code to access the DB should be in a Java class, not a JSP.