把编译后的class文件放到服务器的webapp/ROOT/WEB-INF/classes下面的具体包的子目录中。然后配置XML
<servlet>
<servlet-name>Servlet2</servlet-name>
<servlet-class>coreservlets.HelloServlet2</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet2</servlet-name>
<url-pattern>/servlet2</url-pattern>