Given the deployment descriptor for a Web Application is
Reveal answer
Fill a bubble to check yourself
Given the deployment descriptor for a Web Application is
The Servlet will output 'javabeat null' in the Server Console.
The Servlet will fail to load as the init param property 'no-name' is not mentioned in the deployment descriptor
A NullPointerException will be raised as calling getServletConfig() in the init() method will return a null reference.
The Servlet will output 'javabeat ' in the Server Console.
The getServletConfig().getInitParameter('no-name') call will return null when the parameter is not defined in web.xml, but this does not cause an exception - the servlet will load successfully and output 'javabeat null'. The init() method can safely call getServletConfig() and getInitParameter() returns null for missing parameters rather than throwing NullPointerException.