Posts

Showing posts from May, 2020

Servlet -- Intricacies to be known

First : it is necessary that you have to start with "/" in <url-pattern> tag like below, if you omit the "/", the tomcat server or any other we server will ail to start saying invalid url patter matcher. <servlet-mapping> <servlet-name>Hello</servlet-name> <url-pattern> /Hello </url-pattern> </servlet-mapping> Second : the url pattern get match strictly with what you had specify in <url-pattern> tag, So if have written like : <url-pattern> /Hello </url-pattern> then, the browser will run the associated servlet to this url when you type specifically: http://localhost:8080 /Hello only. http://localhost:8080 /Hello/  will not work and say requested page not found. Third :  if you have specified <welcome-file>default.html | .jsp | .htm</welcome-file> but you have not matched the root path "/" to any servlet, i.e, <url-pattern> / </url-pattern> has not de...