步骤来创建Java Web应用程序: 1,创建新的动态Web项目 2.复印现有的servlet文件src文件夹 3.创建 中的WebContent文件/ WEB-INF文件夹 4。配置web.xml文件,例如:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.ru/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.ru/xml/ns/javaee http://java.sun.ru/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>test.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
用您的servlet类替换 ,也可以替换servlet名称 . 在Eclipse中 打开 视图,使用上下文菜单添加新的Tomcat Server,发布项目并运行服务器。