Thanks for responding, Patrick.
I know that I should have a copy of my .class files in the WEB-INF/classes folder in the deployment directory. But my problem was that the source files did not compile.
I went ahead and compiled the 2 .java files in my
IDE and they compiled fine. I don't know why I had trouble doing the same from the command prompt.
My
servlets work fine and I got the desired output as well.