JAVA EE是一個標準。這個標準有多種實現。 GlassFish服務器是Oracle的參考實現。正如Kostja已經提到的那樣,這個實現包含了一堆罐子。根據您要使用哪種EE技術,您需要不同的罐子組。
如果你只想寫servelets,Apache的Tomcat是夠你,GlassFish還可以工作,但是GlassFish是一個完整的應用服務器,其中Tomcat是servlet容器。
只需創建一個maven Web項目和tomcat下部署。你不需要安裝任何東西。 Maven將爲你提供必要的EE罐。
下面是一個簡單的Web應用程序樣本的pom.xml。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.mavenbook.ch05</groupId>
<artifactId>simple-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>simple-webapp Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
因此,您在上一個問題的答案底部沒有閱讀「無關」註釋(以及鏈接和鏈接等)? http://stackoverflow.com/questions/6025735/running-servlets-in-apache-tomcat – BalusC 2011-05-18 21:23:53