I have started working on a Web java learning project.
I am making a webapp and I want to register users to the website:
Whats the best way to implement registration functionality:
-
Have a register.html and in form call a servlet register which registers the user into database.
-
Or have a jsp page which does all this or similarly call the servlet .
-
Or any other..
Please explain the reasons too, that why one is better than other, or why some method should be used or preferred?
Thanks
All three that you cite are equivalent. JSPs are compiled into servlets that are HTML factories.
Yes, you need a web UI.
You’ll need a database to persist the data, so you’ll be using JDBC.
You’ll need some object and relational models representing users and their credentials.
You’ll want to read about Model-2 MVC for web apps. It describes an architecture where JSPs interact with a servlet, which delegates to other objects to do the work and redirects the response to the right JSP depending on what happens.
You’ll want to read about the front controller servlet.