Is it necessary to learn Servlet programming when one is already comfortable with JSP

depends ... do you want to use java code?
if you are using javacode in snippets:

<%
String b = "a small snippet";
%>

in your jsp's, then my recommendation: YES, unless you'll only be working with small, personal pages that won't need to be very secure, nor easy to maintain.

if you want to improve a (decent) recruiter with your jsp skills and you show him code as above, with snippets in it .... mission failed.
if you ever have to maintain a large application which contains a lot of such snippets .... welcome in hell.

It is recommented to use servlet.If we talk about logic and large set of code then write in java(servlet) file rather in JSP. However to just display data in jsp is fine enough.
Let an example
JSP servlet are used for webapplication and we have to show the content dynamically so based on logic hows you retreice the data let by using database write that code in servlet and to display use JSP.
However in real scenariao neither purly JSP used nor servlet combination of both used.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.