While servlets can be considered Java classes that contain some html code, JSPs can be considered as html pages (except for the .jsp extension and some extra lines) with some java inside.
If we use servlets, we should use a print statement for sending every line of the html code to the client.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<h1>This is a simple JSP file</h1>
This is a simple JSP File.
<br> This JSP file does not contain any java code.
The above example JSP contents may be written using servlets as:
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
As a simple practice, if you have lot of html code than java then use JSPs and if you have more java logic, then use servlets.