ServletConfig config = pageContext.getServletConfig(); String servletName = config.getServletName(); out.println("Servlet name: " + servletName);This example retrieves the ServletConfig object from the PageContext and then gets the name of the servlet using the getServletName() method. Package Library: javax.servlet.jsp