Glassfish:它是如何工作的?
我正在尝试学习如何使用 Glassfish(一个 Java 应用程序服务器)创建动态网站。我是一名高级 PHP 程序员和一名相当优秀的 Java 程序员,但我从未考虑过使用 Java 作为网页的服务器端部分。
我听说过术语“JSP”(Java Server Page)和“Servlet”。有什么区别? Glassfish 使用哪个?其中一个比另一个有优势吗?
另外,如果您对教程或学习方法有任何建议,我将不胜感激。谢谢!
I'm trying to learn how to create dynamic websites using Glassfish (a Java application server). I'm an advanced PHP programmer and a pretty good Java programmer, but I've never looked into using Java as the serverside part of a web page.
I've heard the terms "JSP" (Java Server Page) and "Servlet" thrown around. What's the difference? Which does Glassfish use? Is there an advantage to one over the other?
Also, if you have any recommendations for tutorials or learning methods, I'd appreciate the links. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
JSP 与 PHP 页面相当,因为它混合了 Java 和 HTML/CSS 等。Servlet 是纯 Java 类。 JPS 在内部被编译为 Servlet。 Glassfish 两者都可以使用。
JSP 的优点是您可以将 HTML 放入其中。这也是一个缺点,因为它可能被滥用。
JSP is comparable to PHP pages as there is a mix of Java and HTML/CSS etc. Servlets are pure Java classes. Internally JPS are compiled to Servlets. Glassfish can use both.
Advantages to JSP is that you could put HTML in them. That is also a disadvantage as it can be misused.
JSP 可能确实最接近 PHP,但我想鼓励您查看 JSF,这是一个面向组件的模型-视图-控制器框架,它是 Java EE(GlassFish 完全实现的标准)的一部分。还有 JAX-RS,这是另一种将 Java 对象公开为 RESTful 资源的 Java EE 技术。它们都建立在 Servlet 技术之上。
JSP may be the closest to PHP indeed but I'd like to encourage you to look at JSF, a component-orianted Model-View-Controler framework which is part of Java EE, the standard that GlassFish implements fully. There's also JAX-RS, another Java EE technology to expose Java object are RESTful resources. Both of them are built on top of the Servlet technology.