How does getRequestDispatcher(\"xxx\") get called from getServletContext() in the example below? How does calling procedures like this work in gene
getServletContext() returns a ServletContext object, which has a method called getRequestDispatcher(). Your line of code is just shorthand for two method calls, and is equivalent to this code:
ServletContext context = getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher("/index.jsp");