I'm not real familiar with Netbeans, but I am assuming you can choose a project type and did you choose
J2EE or Web Application project type? I would hope Netbeans would add the servlet-api.jar to the classpath, but maybe it doesn't. You might check that.