关于 Java EE 6 架构的问题

发布于 2024-10-03 03:28:45 字数 548 浏览 0 评论 0原文

alt text

  1. 从上图中,我可以得出结论,Java EE 6 架构是一个 3 层架构。我不明白的是,客户层到底是什么? UI 代码不应该是客户端层吗? JSF 处理应用程序的 UI,JSF 不应该在客户端层吗?

  2. Java EE 6 采用三层架构,JSF 是 MVC 模型,有人能告诉我我所说的是正确还是错误吗? 3 层架构是一种线性模型,其中客户端输入不能直接进入数据层。一切都必须通过中间层。那么我们的JSF就是一个MVC模型。我们都知道控制器是 FacesServlet,视图是 Page 本身。 什么是模型?

它不可能是数据库本身,因为 3-tiers 表示一切都必须经过中间层。 Model 是托管 bean,充当数据库的网关吗?

b.由于JSF已经处于中间层,因此模型实际上是数据库。

alt text

  1. From the picture above, I would conclude that Java EE 6 architecture is an 3 tier architecture. What I dont understand is what exactly is the client tier? Isn't the UI code suppose to be the client tier. JSF handle the UI of the application, shouldn't JSF be at the client tier?

  2. Java EE 6 utilizes 3-tiers architecture, and JSF is an MVC model, can somebody tell me what I am about to say is correct or not? 3-Tiers architecture is a linear model, where client input cant go directly to the data tier. Everything must go through the middle tier. Then we have JSF is a MVC model. Well we all know the controller is the FacesServlet, the view is the Page itself. What is the Model?

a. It cant be the database itself, since 3-tiers said that everything must go through the middle tier. Is the Model is the managed bean, served as a gate way to the database?

OR

b. since JSF is already in the middle tier, therefore the Model is in fact the database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倦话 2024-10-10 03:28:45

客户端层是在客户端计算机中运行的所有内容。对于 (Java EE) Web 应用程序,通常是 Web 浏览器。它运行的只是HTML/CSS/JS,并通过HTTP与服务器端通信。 UI 代码(JSF 代码)被图中的 Web 层覆盖。它生成 HTML/CSS/JS 并将其发送到客户端。

实际上,整个 JSF 完全适合 Web 层。 Web 层中的 JSF 部分本身可以进一步分为模型(托管 bean)、视图(JSP/Facelets 页面)和控制器(FacesServlet)。业务层涵盖EJB。然后是持久性实体(也称为数据传输对象),它们可以遍历从数据库到业务到 Web 并返回的所有层。

The client tier is everything which runs in the client machine. In case of a (Java EE) web application, that's usually the webbrowser. All it runs is HTML/CSS/JS and it communicates with the server side by HTTP. The UI code (the JSF code) is covered by the web tier in the picture. It generates and sends HTML/CSS/JS to the client side.

Actually, the whole JSF thing fits fully in the web tier. The JSF part in the web tier can itself be divided further in model (managed beans), view (JSP/Facelets pages) and controller (FacesServlet). The business tier covers the EJB's. Then there are persistence entities (also called data transfer objects) which can go through all the tiers from the database through business to web and back.

梦回梦里 2024-10-10 03:28:45

除了 M.@BalusC 很好地解释的之外,这里还有一个很好的模式,它说明了(第一个问题)JSF 在表示层(包括客户端)中的位置:

使用 EJB 和 JSF 的 JavaEE 架构

其中左侧的两个矩形代表表示层,右侧的两个矩形代表业务层。虚线宽矩形代表包含 Web 和 EJB 容器的 Java EE 应用服务器。

In addition of what M. @BalusC well explained, here's a nice schema that illustrates (first question) the position of JSF inside the Presentation tier (which includes client side):

JavaEE Architecture with EJB and JSF

Where the two rectangles in the left, represent the presentation tier, and the two rectangles in the right are for business tier. While the dotted wide rectangle represents the Java EE application server that includes both the web and EJB containers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文