Here are the following behaviours of these three different URLs when trying to access them.
The .html URL doesn't work at all - no content displaying at all, no indication of even getting to the first step (ie, no errors when not logged in)
The .jsp URL throws an error and says that it cannot find the '/includes/headincludes.jsp' file
The .do URL works!
How could this be?
The issue is that when I test all of the above URLs on my development machine, all is working fine. But when I upload to my webhost this just doesn't work, with the exception of the /servlet/ URL - which is why I believe this not to be an issue with the actual mappings - but just wanted to check with one of the Servlet experts here.
No, mappings do not need to contain the word "servlet" -- in fact, doing so make one look rather naive. The ".do" pattern is also a holdover from Struts1 days and looks naive and amateurish.
That's good to know.
Also, servlet mappings should not contain file types such as .jsp and .html. I'm not surprised that those are causing problems.
Modern mappings should be straight-forward and RESTful in nature -- so-called "friendly" URLs.
How do you mean 'RESTful'? I have not come across this term before, although it appears to be a Java framework.
Why would you not be surprised that using ".html" would be causing problems? There are no actual .html files located within the web-app. My understanding of how the files are processed is that all requests first go through web.xml and if a match is there, then it maps that URL to a Servlet. So for example, if I had "page1.html" as a Servlet mapping and also "page1.html" as an actual .html file, then I would never expect the .html file to actually run since the Servlet mapping would always take priority. Is that not the case?
Without more knowledge of how you are mapping the servlet in the deployment descriptor, it's hard to say what the core problem may be.
Please see below to give you an indication.
The .html extensions I have used are not required for the web-application so I can take these out to see if this solves the problem.
But based on my knowledge, I wouldn't have thought that would have made a difference.
subject: URL-Pattern mappings must contain /servlet/?