To get the name of the servlet which we created for our project you just need to create object of " ServletConfig " Interface. By writing these simple lines you can create an object of ServletConfig Interface and find the servlet name as well : ServletConfig ob = getServletConfig(); String servlet_name = ob.getServletName(); Now simply print " servlet_name " variable and also remember this if it's not working try to convert this variable in string type. Hope your error will remove. Output as:
Keen to design and develop web apps by leveraging various java based technologies and tools like springboot,microservices,docker,kubernetes,spring security,thymeleaf,jakarta,spring cloud, java 8.