Yes, JSPs can contain Java (scriptlets <% %>), and they’re compiled into servlets. But embedding Java in them is discouraged; use EL/JSTL instead.
Servlets act as the controller in MVC: they handle requests, call the model (business logic), and forward the result to a JSP (the view). This keeps logic separate from presentation.
Highly Rated Tutors