I have got everything right and my project is compiling. But I am experiencing problem with servlets, when I right click on a servlet and click on run in netbeans then I get following two error:
1) Class "Servlet1" neither has a main method not it a servlet specified in web.xml
2) Class "Servlet1" does not have a main method.
My serlvet is defined in web.xml, i have checked it in web.xml:
<servlet> <servlet-name>Servlet1</servlet-name> <servlet-class>Servlet1</servlet-class> </servlet> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/Servlet1</url-pattern> </servlet-mapping>
And our teacher was running servlet without any main method, so I can't figure out what is wrong with it?