Thanks Sophia for the tip. I was able to compile servlet. But, I was able to do it through command prompt only.
Is it possible to compile servlets through free visual IDEs available like Jbuilder Foundation, or visual cafe?? I was not successful in compiling the servlet through JBuilder Foundation. It doesnt recognize the import javax.servlet line.