Sling Resolution is an important module in Sling. It is really important to understand the sling resolution before even starting AEM development. I have tried to explain the same here for a similar question here Template component can't override page.html . This explains how the files are resolved.
To answer your question simply,
if the user request a content as --> <path>.<selector...>.<extension>
then for the request resolution files ending with <selector>.<extension>.<script extension> takes priority
Always understand that selectors have maximum priority and the more selectors are matched the highest the priority. If selectors are not matched then the extension gets priority.
HTML will be preferred over JSP .(If they have same file name) Also extension should not be confused as while script selection Selcetor + extension will be the best match and it will be given priority .
So if you are trying localhost//resourcePath/selector1.selector2.extension.