This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
You need a URL mapping in your web.xml, something like this:
Not wanting to open a can of worms, suffice it to say that some containers allow using the servlet's class in the URL. But such practice is strongly discouraged. Stick with the spec which requires an explicit URL mapping.
Once you add a servlet mapping to your deployment descriptor (web.xml) you will be able to call your servlet.
Containers used to allow you to call servlets by putting the servlet classname in the URL (Tomcat did this with an invoker servlet which is still there but commented out in the the config files). Most have moved away from this practice as it has proven to be a bad idea.
Approach 1: What is the classpath set for server? If server classpath is set to include "<complete_path>/MyProject" and if MyServlet.class file is kept under "<complete_path>/MyProject/com/its/serv" directory then you should be able to access servlet with URL: http://localhost:8080/MyProject/com.its.serv.MyServlet
Approach 2: I believe when servlet is to be accessed through web.xml, it should be first "deployed" on the server or should be kept under correct directory of already deployed web application (like DefaultWebApplication in case of Tomcat). If your servlet is not under already deployed web application directory, you should first deploy it as war file. Servlet from a deployed application should be accessed with following URL: http://<server_name>:<port>/<Appli Name Given while deploying>/<servlet>
I am also new to servlet programming, so please do let me know if any of above help.