I am confused about the meaning of request.getContextPath(). My file layout is as follows:
MyServer/WebContent:
/Resources/MyImage.jpg
/Resources/Script
The RequestDispatcher
operates already relative to the current web application context. You don't need to prepend the context path.
Why it is required for JS/CSS/image/etc resources which are linked in HTML is simply because it's the webbrowser who has got to download them by a proper URL path. A common starters mistake is that they think that it's the webserver who has got to auto-include them by a local disk file system path somehow. This is thus not true. It has really to be an URL, like the one as you enter in browser's address bar.