What is the jspInit() method?The jspInit() method of the javax.servlet.jsp. JspPage interface is similar to the init() method of servlets. This method is invoked by the container only once when a JSP page is initialized. It can be overridden by a page author to initialize resources such as database and network connections, and to allow a JSP page to read persistent configuration data.
Why shouldn’t we use the constructor, instead of init(), to initialize servlet?Yes. However, that shouldn’t be used. With earlier versions, Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructor a ServletConfig. Although that doesn’t apply any more, but servlet containers still call your no-arg constructor so that you don’t have access to a ServletConfig or ServletContext.