整合Eclipse和Tomcat
首先将下载好的插件解压后的放到eclipse的plug目录中,重启eclipse之后工具栏上就会出现三只小猫:
但插件现在还不能正常使用,继续配置:
在windows->preferences中设置Tomcat,Tomcat version 设为7.x,home定位到opt里的目录,如图:

还需要设置Tomcat->advanced中的Tomcat base 定位到opt里的目录即可,然后Apply->ok。
eclipse中servlet和jsp的开发环境就算配置好了。
简单的例子
1)首先创建一个server
File->New->Server:
一路下一步就可以了。
2)创建一个Dynamic web project
File->New->Dynamic web project

随便取个名字,finish就可以了。
注:项目的WEB-INF目录下没有web.xml文件。
3)在webcontent目录下创建index.jsp
File->New->JSP File
代码:
-
- <%@ page language="Java" contentType="text/html; charset=UTF-8"
-
- pageEncoding="UTF-8"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Insert title here</title>
- </head>
- <body>
- <% java.util.Date d =new java.util.Date();%>
- <h1>Today's date is<%= d.toString()%></h1>
- </body>
- </html>
