J2EE (now called Java EE) application servers can host more than one "webapp". The portion of the URI just after the port (shown in bold) is known as the contextPath for a webapp.
In this case 'index.html' is in root directory of the webapp called myWebApp.
In those links you've posted, the developer (rightly) built the relative links by reading the contextPath from the request object. This allows for the renaming of the webapp without the need to alter every link in the app.
No. The point is that for resources referenced fomr the client such as images, style sheets and script files. the context path is required. Otherwise, the server wouldn't know which web app was being referenced.
If you hard-code the context path, you'd need to fix all these references up if it were to change.