java 可以使用 JavaSE 编写 Web 应用程序吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1900673/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 18:26:37  来源:igfitidea点击:

Can JavaSE be used to write a web application?

jakarta-eejava

提问by DNB5brims

I know that J2EE can be used for JSP + Servlets. However, can I use J2SE for JSP & Servlets?

我知道 J2EE 可以用于 JSP + Servlets。但是,我可以将 J2SE 用于 JSP 和 Servlets 吗?

回答by BalusC

No, you can't. You need boththe Java SE and a JSP/Servlet implementation (a web container), such as for example Apache Tomcator Oracle GlassFish(which is also part of the Oracle Java EEdownload).

不,你不能。您需要两个在Java SE和JSP / Servlet实现(Web容器),例如Apache Tomcat上甲骨文的GlassFish(这也是甲骨文的一部分的Java EE下载)。

To be clear: you don't necessarily need to download the whole Java EE thing from Oracle in order to be able to develop webapps on Tomcat. Just the Java SE JDK is enough. The Java EE download is actually nothing else than Oracle's own (reference) implementation of the abstract Java EE specification, better known as "GlassFish", bundled with some documentation, examples and optionally the Netbeans IDE.

需要明确的是:您不一定需要从 Oracle 下载整个 Java EE 才能在 Tomcat 上开发 Web 应用程序。只需要 Java SE JDK 就足够了。Java EE 下载实际上就是 Oracle 自己的抽象 Java EE 规范(参考)实现,更为人所知的是“GlassFish”,捆绑了一些文档、示例和可选的 Netbeans IDE。

回答by Brian Agnew

J2EE is a set of APIs. JSPs and servlets are technologies and APIs within the J2EE domain. So I think that this question is a little confusing.

J2EE 是一组 API。JSP 和 servlet 是 J2EE 域中的技术和 API。所以我认为这个问题有点令人困惑。

People often use J2EE as shorthand for EJBs and application containers (WebSphere/WebLogic etc.). Instead you can run up a servlet container (e.g. Tomcat/Jetty etc.) which handles web technologies but little else, using the standard J2SE with (say) the Servlet API and nothing else. I suspect that's what you're after.

人们经常使用 J2EE 作为 EJB 和应用程序容器(WebSphere/WebLogic 等)的简写。相反,您可以运行一个 servlet 容器(例如 Tomcat/Jetty 等),该容器处理 Web 技术但很少使用其他技术,使用标准 J2SE 和(比如)Servlet API 而没有别的。我怀疑这就是你所追求的。

回答by JCasso

Servlet API is included both in Java EE and Java SE.So you can use it with Java SE. You will also need an application server.

Servlet API 包含在 Java EE 和 Java SE 中。所以你可以将它与 Java SE 一起使用。您还需要一个应用程序服务器。

Java application servers: http://en.wikipedia.org/wiki/Application_server#Java_application_servers

Java 应用服务器:http: //en.wikipedia.org/wiki/Application_server#Java_application_servers