I like to know like whenever user requests a jsp page we write hello.jsp or any html file we write hello.html or any image hello.jpeg.
My question is does servlet not have any extension ? Is it called directly called by name?
I like to know like whenever user requests a jsp page we write hello.jsp
Share
For Servlets, you have to explicitly tell the Servlet Container what URLs (either specific URLs or wildcards) map to what servlet. For example:
The above example would map the URL
/helloto the servletcom.example.HelloWorld.You can also do some wildcard mapping. For example:
This would map requests ending in “
.html” to the HelloWorld servlet. But you aren’t limited to any particular extensions. You could use anything you want:All of this configuration takes place in your web application’s
web.xmlfile.