下载Eclipse
http://www.eclipse.org/
下载Tomcat Eclipse插件
http://www.eclipsetotale.com/tomcatPlugin.html
将tomcatPluginV321.zip内容解压到 Eclipse 的 plugins 目录,然后重启Eclipse
Window->Perferences->Tomcat 配置好版本目录等熟悉,记得按Apply
下载Tomcat
http://tomcat.apache.org/
测试servlet例子
File->New->New Project(java Tomcat Project)
输入 test next 再输入 test 最后finish
右键test工程,new class 包名test,类名test
超类的名称写上javax.servlet.http.HttpServlet
打开test.java ,右键test.java文件内容 source->Override/Implement Methods
选上 doGet doPost
去掉基类调用super.doGet(req, resp);
输入
右击PrintWriter,source->Organize Import
然后右击test工程,选择Properties->java build path->order and export 全选然确定
创建该工程的部署文件web.xml 放到test/Web-INF目录下
启动tomcat
访问 http://localhost:8080/test/test