I guess you did something wrong in creating the .war file. According to me you might have created war on example2 folder. Dont do this, go to example2 folder and then create the war file. For example if your folder is under c:\example2 then do the following.
1) cd c:\example2
2) jar -cvf example2.war *
you might have done as below.
1) c:\> jar -cvf example2.war example2/* or zipped it using tools like winzip.
If you still like to do the way you did then you need to change the servlet mapping in the web.xml...you need to specify
Thanks lokesh! that helped. The problem was with .war creation (I zipped example2 folder itself, rather than cd-ing into it and zipping the contents) and in the JSP link referencing the Servlet.
btw, I tried zipping the example2 folder itself, the change is required for the JSP link to the Servlet and not the <url-pattern> in web.xml
The url pattern can be anything. It just gets appended to http://localhost:8080/<.war_package_name/>/**here**
The JSP link to the servlet must give the full path (/.war_name/<url-pattern>/).
I have posted a working example under the other thread, for others with a similar problem: